MangleNumberingContext.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //=== MangleNumberingContext.h - Context for mangling numbers ---*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines the LambdaBlockMangleContext interface, which keeps track
  15. // of the Itanium C++ ABI mangling numbers for lambda expressions and block
  16. // literals.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CLANG_AST_MANGLENUMBERINGCONTEXT_H
  20. #define LLVM_CLANG_AST_MANGLENUMBERINGCONTEXT_H
  21. #include "clang/Basic/LLVM.h"
  22. #include "llvm/ADT/IntrusiveRefCntPtr.h"
  23. namespace clang {
  24. class BlockDecl;
  25. class CXXMethodDecl;
  26. class TagDecl;
  27. class VarDecl;
  28. /// Keeps track of the mangled names of lambda expressions and block
  29. /// literals within a particular context.
  30. class MangleNumberingContext {
  31. public:
  32. virtual ~MangleNumberingContext() {}
  33. /// Retrieve the mangling number of a new lambda expression with the
  34. /// given call operator within this context.
  35. virtual unsigned getManglingNumber(const CXXMethodDecl *CallOperator) = 0;
  36. /// Retrieve the mangling number of a new block literal within this
  37. /// context.
  38. virtual unsigned getManglingNumber(const BlockDecl *BD) = 0;
  39. /// Static locals are numbered by source order.
  40. virtual unsigned getStaticLocalNumber(const VarDecl *VD) = 0;
  41. /// Retrieve the mangling number of a static local variable within
  42. /// this context.
  43. virtual unsigned getManglingNumber(const VarDecl *VD,
  44. unsigned MSLocalManglingNumber) = 0;
  45. /// Retrieve the mangling number of a static local variable within
  46. /// this context.
  47. virtual unsigned getManglingNumber(const TagDecl *TD,
  48. unsigned MSLocalManglingNumber) = 0;
  49. /// Retrieve the mangling number of a new lambda expression with the
  50. /// given call operator within the device context. No device number is
  51. /// assigned if there's no device numbering context is associated.
  52. virtual unsigned getDeviceManglingNumber(const CXXMethodDecl *) { return 0; }
  53. };
  54. } // end namespace clang
  55. #endif
  56. #ifdef __GNUC__
  57. #pragma GCC diagnostic pop
  58. #endif