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