clang: include/clang/AST/DeclID.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_CLANG_AST_DECLID_H
17#define LLVM_CLANG_AST_DECLID_H
18
19#include "llvm/ADT/DenseMapInfo.h"
20#include "llvm/ADT/Hashing.h"
21#include "llvm/ADT/iterator.h"
22
24
25
26
27
28
29
30
32
34
35
37
38
40
41
43
44
46
47
49
50
52
53
55
56
58
59
61
62
64
65
67
68
70
71
73
74
76
77
79
80
82
83
85
86
88
89
92
93
94
95
96
97
98
99
101public:
102
103
104
105
106
107
108
109
110
112
113protected:
116
117public:
119
120 explicit operator DeclID() const { return ID; }
121
123
125
127
129
131
132
134 return LHS.ID == RHS;
135 }
138 }
140 return LHS.ID < RHS;
141 }
143 return LHS.ID <= RHS;
144 }
146 return LHS.ID > RHS;
147 }
149 return LHS.ID >= RHS;
150 }
151
154 }
157 }
158
159
162 }
165 }
168 }
171 }
172
173protected:
175};
176
179namespace serialization {
180class ModuleFile;
181}
182
185
188
189
193
194public:
196
200 unsigned ModuleFileIndex, unsigned LocalDeclID);
201
203 ++ID;
204 return *this;
205 }
206
209 ++(*this);
210 return Ret;
211 }
212};
213
216
217public:
220
221 explicit GlobalDeclID(unsigned ModuleFileIndex, unsigned LocalID)
223
224
225
227};
228
229
230
231template <class FromTy, class ToTy>
233 : public llvm::iterator_adaptor_base<DeclIDIterator<FromTy, ToTy>,
234 const FromTy *,
235 std::forward_iterator_tag, ToTy> {
236public:
238
241
242 ToTy operator*() const { return ToTy(*this->I); }
243
245};
246
247}
248
249namespace llvm {
253
255 return GlobalDeclID(DenseMapInfo::getEmptyKey());
256 }
257
259 return GlobalDeclID(DenseMapInfo::getTombstoneKey());
260 }
261
263 return DenseMapInfo::getHashValue(Key.getRawValue());
264 }
265
267 return L == R;
268 }
269};
270
274
276 return LocalDeclID(DenseMapInfo::getEmptyKey());
277 }
278
280 return LocalDeclID(DenseMapInfo::getTombstoneKey());
281 }
282
284 return DenseMapInfo::getHashValue(Key.getRawValue());
285 }
286
288 return L == R;
289 }
290};
291
292}
293
294#endif
Reads an AST files chain containing the contents of a translation unit.
Writes an AST file containing the contents of a translation unit.
GlobalDeclID means DeclID in the current ASTContext and LocalDeclID means DeclID specific to a certai...
friend bool operator!=(const DeclIDBase &LHS, const DeclID &RHS)
friend bool operator==(const DeclIDBase &LHS, const DeclIDBase &RHS)
friend bool operator>(const DeclIDBase &LHS, const DeclIDBase &RHS)
unsigned getModuleFileIndex() const
friend bool operator<(const DeclIDBase &LHS, const DeclID &RHS)
DeclID getRawValue() const
friend bool operator==(const DeclIDBase &LHS, const DeclID &RHS)
unsigned getLocalDeclIndex() const
friend bool operator!=(const DeclIDBase &LHS, const DeclIDBase &RHS)
uint64_t DeclID
An ID number that refers to a declaration in an AST file.
friend bool operator<=(const DeclIDBase &LHS, const DeclIDBase &RHS)
friend bool operator<=(const DeclIDBase &LHS, const DeclID &RHS)
friend bool operator>=(const DeclIDBase &LHS, const DeclIDBase &RHS)
friend bool operator>(const DeclIDBase &LHS, const DeclID &RHS)
friend bool operator>=(const DeclIDBase &LHS, const DeclID &RHS)
friend bool operator<(const DeclIDBase &LHS, const DeclIDBase &RHS)
A helper iterator adaptor to convert the iterators to SmallVector to the iterators to Sma...
DeclIDIterator(const FromTy *ID)
bool operator==(const DeclIDIterator &RHS) const
GlobalDeclID(unsigned ModuleFileIndex, unsigned LocalID)
LocalDeclID & operator++()
friend class GlobalDeclID
static LocalDeclID get(ASTReader &Reader, serialization::ModuleFile &MF, DeclID ID)
LocalDeclID operator++(int)
Information about a module that has been loaded by the ASTReader.
The JSON file list parser is used to communicate input to InstallAPI.
PredefinedDeclIDs
Predefined declaration IDs.
@ PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID
The internal '__NSConstantString' tag type.
@ PREDEF_DECL_COMMON_TYPE_ID
The internal '__builtin_common_type' template.
@ PREDEF_DECL_TRANSLATION_UNIT_ID
The translation unit.
@ PREDEF_DECL_TYPE_PACK_ELEMENT_ID
The internal '__type_pack_element' template.
@ PREDEF_DECL_OBJC_CLASS_ID
The Objective-C 'Class' type.
@ PREDEF_DECL_BUILTIN_MS_GUID_ID
The predeclared '_GUID' struct.
@ PREDEF_DECL_OBJC_INSTANCETYPE_ID
The internal 'instancetype' typedef.
@ PREDEF_DECL_OBJC_PROTOCOL_ID
The Objective-C 'Protocol' type.
@ PREDEF_DECL_UNSIGNED_INT_128_ID
The unsigned 128-bit integer type.
@ PREDEF_DECL_OBJC_SEL_ID
The Objective-C 'SEL' type.
@ NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
@ PREDEF_DECL_INT_128_ID
The signed 128-bit integer type.
@ PREDEF_DECL_VA_LIST_TAG
The internal '__va_list_tag' struct, if any.
@ PREDEF_DECL_BUILTIN_MS_VA_LIST_ID
The internal '__builtin_ms_va_list' typedef.
@ PREDEF_DECL_CF_CONSTANT_STRING_ID
The internal '__NSConstantString' typedef.
@ PREDEF_DECL_NULL_ID
The NULL declaration.
@ PREDEF_DECL_BUILTIN_VA_LIST_ID
The internal '__builtin_va_list' typedef.
@ PREDEF_DECL_EXTERN_C_CONTEXT_ID
The extern "C" context.
@ PREDEF_DECL_OBJC_ID_ID
The Objective-C 'id' type.
@ PREDEF_DECL_MAKE_INTEGER_SEQ_ID
The internal '__make_integer_seq' template.
Diagnostic wrappers for TextAPI types for error reporting.
GlobalDeclID::DeclID DeclID
static GlobalDeclID getTombstoneKey()
static unsigned getHashValue(const GlobalDeclID &Key)
static GlobalDeclID getEmptyKey()
static bool isEqual(const GlobalDeclID &L, const GlobalDeclID &R)
static unsigned getHashValue(const LocalDeclID &Key)
static LocalDeclID getTombstoneKey()
static bool isEqual(const LocalDeclID &L, const LocalDeclID &R)
static LocalDeclID getEmptyKey()
LocalDeclID::DeclID DeclID