clang  19.0.0git
MangleNumberingContext.h
Go to the documentation of this file.
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.
30  // The index of the next lambda we encounter in this context.
31  unsigned LambdaIndex = 0;
32 
33 public:
35 
36  /// Retrieve the mangling number of a new lambda expression with the
37  /// given call operator within this context.
38  virtual unsigned getManglingNumber(const CXXMethodDecl *CallOperator) = 0;
39 
40  /// Retrieve the mangling number of a new block literal within this
41  /// context.
42  virtual unsigned getManglingNumber(const BlockDecl *BD) = 0;
43 
44  /// Static locals are numbered by source order.
45  virtual unsigned getStaticLocalNumber(const VarDecl *VD) = 0;
46 
47  /// Retrieve the mangling number of a static local variable within
48  /// this context.
49  virtual unsigned getManglingNumber(const VarDecl *VD,
50  unsigned MSLocalManglingNumber) = 0;
51 
52  /// Retrieve the mangling number of a static local variable within
53  /// this context.
54  virtual unsigned getManglingNumber(const TagDecl *TD,
55  unsigned MSLocalManglingNumber) = 0;
56 
57  /// Retrieve the mangling number of a new lambda expression with the
58  /// given call operator within the device context. No device number is
59  /// assigned if there's no device numbering context is associated.
60  virtual unsigned getDeviceManglingNumber(const CXXMethodDecl *) { return 0; }
61 
62  // Retrieve the index of the next lambda appearing in this context, which is
63  // used for deduplicating lambdas across modules. Note that this is a simple
64  // sequence number and is not ABI-dependent.
65  unsigned getNextLambdaIndex() { return LambdaIndex++; }
66 };
67 
68 } // end namespace clang
69 #endif
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4497
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2060
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
virtual unsigned getManglingNumber(const CXXMethodDecl *CallOperator)=0
Retrieve the mangling number of a new lambda expression with the given call operator within this cont...
virtual unsigned getManglingNumber(const VarDecl *VD, unsigned MSLocalManglingNumber)=0
Retrieve the mangling number of a static local variable within this context.
virtual unsigned getManglingNumber(const TagDecl *TD, unsigned MSLocalManglingNumber)=0
Retrieve the mangling number of a static local variable within this context.
virtual unsigned getManglingNumber(const BlockDecl *BD)=0
Retrieve the mangling number of a new block literal within this context.
virtual unsigned getStaticLocalNumber(const VarDecl *VD)=0
Static locals are numbered by source order.
virtual unsigned getDeviceManglingNumber(const CXXMethodDecl *)
Retrieve the mangling number of a new lambda expression with the given call operator within the devic...
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3587
Represents a variable declaration or definition.
Definition: Decl.h:919
The JSON file list parser is used to communicate input to InstallAPI.