clang: lib/Serialization/ASTReaderInternals.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_LIB_SERIALIZATION_ASTREADERINTERNALS_H
14#define LLVM_CLANG_LIB_SERIALIZATION_ASTREADERINTERNALS_H
15
20#include "llvm/ADT/DenseSet.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/StringRef.h"
23#include "llvm/Support/OnDiskHashTable.h"
24#include
25#include
26
28
29class ASTReader;
30class FileEntry;
31struct HeaderFileInfo;
33class ObjCMethodDecl;
35
36namespace serialization {
37
39
40namespace reader {
41
43protected:
46
47public:
48
50
51
53
57
59
61
62 if (Found.empty() && .empty()) {
63 if (Data.size() <= 4) {
64 for (auto I : Found)
65 if (I == ID)
66 return;
68 return;
69 }
70
71
73 }
74
75 if (Found.insert(ID).second)
77 }
78 };
82
83protected:
86
87public:
88 static std::pair<unsigned, unsigned>
90
91 void ReadDataIntoImpl(const unsigned char *d, unsigned DataLen,
92 data_type_builder &Val);
93
95 To.Data.reserve(To.Data.size() + From.size());
98 }
99
101
103};
104
105
106
108public:
111
114
116 return a == b;
117 }
118
121 }
122
124 return Name;
125 }
126
128
130 unsigned DataLen, data_type_builder &Val);
131};
132
135};
136
138public:
141
144
146 return a == b;
147 }
148
151
153
155 data_type_builder &Val);
156};
157
160};
161
163
164
168
169public:
170
172
173
175
179
181
183
184 if (Found.empty() && .empty()) {
185 if (Data.size() <= 4) {
186 for (auto I : Found)
187 if (I == Info)
188 return;
189 Data.push_back(Info);
190 return;
191 }
192
193
195 }
196
197 if (Found.insert(Info).second)
198 Data.push_back(Info);
199 }
200 };
204
207
209 : Reader(Reader), F(F) {}
210
212 return a == b;
213 }
214
216 return Key;
217 }
218
220 return Name;
221 }
222
223 static std::pair<unsigned, unsigned>
225
227
229 data_type_builder &Val);
230
232 To.Data.reserve(To.Data.size() + From.size());
235 }
236
238};
239
242};
243
244
245
246
247
248
249
250
251
253public:
258
260 return a == b;
261 }
262
264
265 static std::pair<unsigned, unsigned>
267
268
271
272
275
277};
278
279
283
284
285
286
288
289public:
291
294 : Reader(Reader), F(F), KnownII(II) {}
295
297 const unsigned char* d,
298 unsigned DataLen);
299
301
303};
304
305
306
308 llvm::OnDiskIterableChainedHashTable;
309
310
311
315
316public:
325 };
326
331
333 : Reader(Reader), F(F) {}
334
337 return a == b;
338 }
339
341
344
345 static std::pair<unsigned, unsigned>
347
349 data_type ReadData(Selector, const unsigned char* d, unsigned DataLen);
350};
351
352
354 llvm::OnDiskChainedHashTable;
355
356
357
358
359
360
361
362
363
364
368
369public:
371
377 };
378
380
384
386 : Reader(Reader), M(M) {}
387
391
392 static std::pair<unsigned, unsigned>
394
395 static internal_key_type ReadKey(const unsigned char *d, unsigned);
396
398
399private:
401};
402
403
405 llvm::OnDiskChainedHashTable;
406
407}
408
409}
410
411}
412
413#endif
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Reads an AST files chain containing the contents of a translation unit.
The name of a declaration.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
One of these records is kept for each identifier that is lexed.
Smart pointer class that efficiently represents Objective-C method names.
A key used when looking up entities by DeclarationName.
unsigned getHash() const
Compute a fingerprint of this key for use in on-disk hash table.
Information about a module that has been loaded by the ASTReader.
A collection of on-disk hash tables, merged when relevant for performance.
ASTDeclContextNameLookupTraitBase(ASTReader &Reader, ModuleFile &F)
static const int MaxTables
static void MergeDataInto(const data_type &From, data_type_builder &To)
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
void ReadDataIntoImpl(const unsigned char *d, unsigned DataLen, data_type_builder &Val)
file_type ReadFileRef(const unsigned char *&d)
DeclarationNameKey ReadKeyBase(const unsigned char *&d)
Class that performs name lookup into a DeclContext stored in an AST file.
static bool EqualKey(const internal_key_type &a, const internal_key_type &b)
internal_key_type ReadKey(const unsigned char *d, unsigned)
static internal_key_type GetInternalKey(const external_key_type &Name)
DeclarationNameKey internal_key_type
void ReadDataInto(internal_key_type, const unsigned char *d, unsigned DataLen, data_type_builder &Val)
static hash_value_type ComputeHash(const internal_key_type &Key)
ASTDeclContextNameLookupTrait(ASTReader &Reader, ModuleFile &F)
Base class for the trait describing the on-disk hash table for the identifiers in an AST file.
static bool EqualKey(const internal_key_type &a, const internal_key_type &b)
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static const internal_key_type & GetInternalKey(const external_key_type &x)
static hash_value_type ComputeHash(const internal_key_type &a)
static const external_key_type & GetExternalKey(const internal_key_type &x)
StringRef external_key_type
StringRef internal_key_type
static internal_key_type ReadKey(const unsigned char *d, unsigned n)
Class that performs lookup for an identifier stored in an AST file.
ASTIdentifierLookupTrait(ASTReader &Reader, ModuleFile &F, IdentifierInfo *II=nullptr)
IdentifierID ReadIdentifierID(const unsigned char *d)
ASTReader & getReader() const
data_type ReadData(const internal_key_type &k, const unsigned char *d, unsigned DataLen)
IdentifierInfo * data_type
Class that performs lookup for a selector's entries in the global method pool stored in an AST file.
internal_key_type ReadKey(const unsigned char *d, unsigned)
ASTSelectorLookupTrait(ASTReader &Reader, ModuleFile &F)
data_type ReadData(Selector, const unsigned char *d, unsigned DataLen)
Selector external_key_type
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(Selector Sel)
static const internal_key_type & GetInternalKey(const external_key_type &x)
external_key_type internal_key_type
static bool EqualKey(const internal_key_type &a, const internal_key_type &b)
Class that performs lookup to specialized decls.
static bool EqualKey(const internal_key_type &a, const internal_key_type &b)
file_type ReadFileRef(const unsigned char *&d)
static internal_key_type GetInternalKey(const external_key_type &Name)
void ReadDataInto(internal_key_type, const unsigned char *d, unsigned DataLen, data_type_builder &Val)
unsigned internal_key_type
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static void MergeDataInto(const data_type &From, data_type_builder &To)
static const int MaxTables
static hash_value_type ComputeHash(const internal_key_type &Key)
LazySpecializationInfoLookupTrait(ASTReader &Reader, ModuleFile &F)
internal_key_type ReadKey(const unsigned char *d, unsigned)
ModuleLocalNameLookupTrait(ASTReader &Reader, ModuleFile &F)
static bool EqualKey(const internal_key_type &a, const internal_key_type &b)
std::pair< DeclarationName, const Module * > external_key_type
void ReadDataInto(internal_key_type, const unsigned char *d, unsigned DataLen, data_type_builder &Val)
std::pair< DeclarationNameKey, unsigned > internal_key_type
internal_key_type ReadKey(const unsigned char *d, unsigned)
static hash_value_type ComputeHash(const internal_key_type &Key)
static internal_key_type GetInternalKey(const external_key_type &Key)
llvm::OnDiskChainedHashTable< HeaderFileInfoTrait > HeaderFileInfoLookupTable
The on-disk hash table used for known header files.
llvm::OnDiskIterableChainedHashTable< ASTIdentifierLookupTrait > ASTIdentifierLookupTable
The on-disk hash table used to contain information about all of the identifiers in the program.
llvm::OnDiskChainedHashTable< ASTSelectorLookupTrait > ASTSelectorLookupTable
The on-disk hash table used for the global method pool.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
The JSON file list parser is used to communicate input to InstallAPI.
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
data_type_builder(data_type &D)
llvm::DenseSet< GlobalDeclID > Found
void insert(GlobalDeclID ID)
SmallVector< ObjCMethodDecl *, 2 > Factory
bool FactoryHasMoreThanOneDecl
SmallVector< ObjCMethodDecl *, 2 > Instance
bool InstanceHasMoreThanOneDecl
MultiOnDiskHashTable< ASTDeclContextNameLookupTrait > Table
MultiOnDiskHashTable< LazySpecializationInfoLookupTrait > Table
llvm::DenseSet< LazySpecializationInfo > Found
void insert(LazySpecializationInfo Info)
data_type_builder(data_type &D)
MultiOnDiskHashTable< ModuleLocalNameLookupTrait > Table