27 const std::vector<ASTDeserializationListener*>& L)
33 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
34 Listeners[i]->ReaderInitialized(Reader);
39 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
40 Listeners[i]->IdentifierRead(ID, II);
45 for (
auto &Listener : Listeners)
46 Listener->MacroRead(ID, MI);
51 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
52 Listeners[i]->TypeRead(Idx, T);
57 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
58 Listeners[i]->DeclRead(ID, D);
62 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
63 Listeners[i]->PredefinedDeclBuilt(ID, D);
68 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
69 Listeners[i]->SelectorRead(ID, Sel);
74 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
75 Listeners[i]->MacroDefinitionRead(ID, MD);
80 for (
auto &Listener : Listeners)
81 Listener->ModuleRead(ID, Mod);
86 for (
auto &Listener : Listeners)
87 Listener->ModuleImportRead(ID, ImportLoc);
109 Expr *ThisArg)
override;
136 std::vector<ASTMutationListener*> Listeners;
141 : Listeners(L.begin(), L.end()) {
145 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
146 Listeners[i]->CompletedTagDefinition(D);
151 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
152 Listeners[i]->AddedVisibleDecl(DC, D);
157 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
158 Listeners[i]->AddedCXXImplicitMember(RD, D);
162 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
163 Listeners[i]->AddedCXXTemplateSpecialization(TD, D);
167 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
168 Listeners[i]->AddedCXXTemplateSpecialization(TD, D);
172 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
173 Listeners[i]->AddedCXXTemplateSpecialization(TD, D);
177 for (
auto &Listener : Listeners)
178 Listener->ResolvedExceptionSpec(FD);
182 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
183 Listeners[i]->DeducedReturnType(FD, ReturnType);
187 for (
auto *L : Listeners)
188 L->ResolvedOperatorDelete(DD,
Delete, ThisArg);
192 for (
auto *L : Listeners)
193 L->ResolvedOperatorGlobDelete(DD, GlobDelete);
197 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
198 Listeners[i]->CompletedImplicitDefinition(D);
201 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
202 Listeners[i]->InstantiationRequested(D);
206 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
207 Listeners[i]->VariableDefinitionInstantiated(D);
211 for (
auto &Listener : Listeners)
212 Listener->FunctionDefinitionInstantiated(D);
216 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
217 Listeners[i]->DefaultArgumentInstantiated(D);
221 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
222 Listeners[i]->DefaultMemberInitializerInstantiated(D);
227 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
228 Listeners[i]->AddedObjCCategoryToInterface(CatD, IFD);
231 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
232 Listeners[i]->DeclarationMarkedUsed(D);
236 for (
size_t i = 0, e = Listeners.size(); i != e; ++i)
237 Listeners[i]->DeclarationMarkedOpenMPThreadPrivate(D);
242 L->DeclarationMarkedOpenMPAllocate(D, A);
247 L->DeclarationMarkedOpenMPIndirectCall(D);
251 for (
auto *L : Listeners)
252 L->DeclarationMarkedOpenMPDeclareTarget(D,
Attr);
256 for (
auto *L : Listeners)
257 L->RedefinedHiddenDefinition(D, M);
263 for (
auto *L : Listeners)
268 for (
auto *L : Listeners)
269 L->EnteringModulePurview();
274 for (
auto *L : Listeners)
275 L->AddedManglingNumber(D, Number);
279 for (
auto *L : Listeners)
280 L->AddedStaticLocalNumbers(D, Number);
284 for (
auto *L : Listeners)
285 L->AddedAnonymousNamespace(TU, AnonNamespace);
291 std::vector<std::unique_ptr<ASTConsumer>>
C)
295 std::vector<ASTMutationListener *> mutationListeners;
296 std::vector<ASTDeserializationListener*> serializationListeners;
298 if (
auto *mutationListener = Consumer->GetASTMutationListener())
299 mutationListeners.push_back(mutationListener);
300 if (
auto *serializationListener = Consumer->GetASTDeserializationListener())
301 serializationListeners.push_back(serializationListener);
303 if (!mutationListeners.empty()) {
305 std::make_unique<MultiplexASTMutationListener>(mutationListeners);
307 if (!serializationListeners.empty()) {
308 DeserializationListener =
309 std::make_unique<MultiplexASTDeserializationListener>(
310 serializationListeners);
316 std::vector<std::unique_ptr<ASTConsumer>>
Consumers;
317 Consumers.push_back(std::move(Consumer));
325 Consumer->Initialize(Context);
329 bool Continue =
true;
331 Continue = Continue && Consumer->HandleTopLevelDecl(D);
337 Consumer->HandleInlineFunctionDefinition(D);
342 Consumer->HandleCXXStaticMemberVarInstantiation(VD);
347 Consumer->HandleInterestingDecl(D);
352 Consumer->HandleTranslationUnit(Ctx);
357 Consumer->HandleTagDeclDefinition(D);
362 Consumer->HandleTagDeclRequiredDefinition(D);
367 Consumer->HandleCXXImplicitFunctionInstantiation(D);
372 Consumer->HandleTopLevelDeclInObjCContainer(D);
377 Consumer->HandleImplicitImportDecl(D);
382 Consumer->CompleteTentativeDefinition(D);
387 Consumer->CompleteExternalDeclaration(D);
392 Consumer->AssignInheritanceModel(RD);
397 Consumer->HandleVTable(RD);
410 Consumer->PrintStats();
416 Skip =
Skip && Consumer->shouldSkipFunctionBody(D);
422 if (
SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer.get()))
423 SC->InitializeSema(S);
428 if (
SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer.get()))
llvm::MachO::Record Record
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Reads an AST files chain containing the contents of a translation unit.
Attr - This represents one attribute.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
Represents a ValueDecl that came out of a declarator.
This represents one expression.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
Declaration of a template function.
One of these records is kept for each identifier that is lexed.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Record the location of a macro definition.
Encapsulates the data about a macro definition (e.g.
Describes a module or submodule.
void IdentifierRead(serialization::IdentifierID ID, IdentifierInfo *II) override
An identifier was deserialized from the AST file.
void MacroDefinitionRead(serialization::PreprocessedEntityID, MacroDefinitionRecord *MD) override
A macro definition was read from the AST file.
void PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) override
A predefined decl was built during the serialization.
void ModuleRead(serialization::SubmoduleID ID, Module *Mod) override
A module definition was read from the AST file.
void TypeRead(serialization::TypeIdx Idx, QualType T) override
A type was deserialized from the AST file.
void DeclRead(GlobalDeclID ID, const Decl *D) override
A decl was deserialized from the AST file.
void SelectorRead(serialization::SelectorID iD, Selector Sel) override
A selector was read from the AST file.
void MacroRead(serialization::MacroID ID, MacroInfo *MI) override
A macro was read from the AST file.
void ReaderInitialized(ASTReader *Reader) override
The ASTReader was initialized.
void ModuleImportRead(serialization::SubmoduleID ID, SourceLocation ImportLoc) override
A module import was read from the AST file.
MultiplexASTDeserializationListener(const std::vector< ASTDeserializationListener * > &L)
void DeclarationMarkedUsed(const Decl *D) override
A declaration is marked used which was not previously marked used.
void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD) override
A new objc category class was added for an interface.
void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override
A definition has been made visible by being redefined locally.
void ResolvedExceptionSpec(const FunctionDecl *FD) override
A function's exception specification has been evaluated or instantiated.
void DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A) override
A declaration is marked as a variable with OpenMP allocator.
void CompletedImplicitDefinition(const FunctionDecl *D) override
An implicit member got a definition.
void EnteringModulePurview() override
The parser find the named module declaration.
void DefaultArgumentInstantiated(const ParmVarDecl *D) override
A default argument was instantiated.
void AddedStaticLocalNumbers(const Decl *D, unsigned) override
An static local number was added to a Decl.
void ResolvedOperatorGlobDelete(const CXXDestructorDecl *DD, const FunctionDecl *GlobDelete) override
A virtual destructor's operator global delete has been resolved.
void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override
A function's return type has been deduced.
void AddedManglingNumber(const Decl *D, unsigned) override
An mangling number was added to a Decl.
void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override
An implicit member was added after the definition was completed.
void VariableDefinitionInstantiated(const VarDecl *D) override
A templated variable's definition was implicitly instantiated.
void AddedAnonymousNamespace(const TranslationUnitDecl *, NamespaceDecl *AnonNamespace) override
An anonymous namespace was added the translation unit decl.
void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override
A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate.
MultiplexASTMutationListener(ArrayRef< ASTMutationListener * > L)
void DeclarationMarkedOpenMPIndirectCall(const Decl *D) override
A declaration is marked as an OpenMP indirect call target.
void ResolvedOperatorDelete(const CXXDestructorDecl *DD, const FunctionDecl *Delete, Expr *ThisArg) override
A virtual destructor's operator delete has been resolved.
void InstantiationRequested(const ValueDecl *D) override
The instantiation of a templated function or variable was requested.
void DeclarationMarkedOpenMPDeclareTarget(const Decl *D, const Attr *Attr) override
A declaration is marked as OpenMP declaretarget which was not previously marked as declaretarget.
void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override
A new declaration with name has been added to a DeclContext.
void FunctionDefinitionInstantiated(const FunctionDecl *D) override
A function template's definition was instantiated.
void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D) override
A template specialization (or partial one) was added to the template declaration.
void DefaultMemberInitializerInstantiated(const FieldDecl *D) override
A default member initializer was instantiated.
void CompletedTagDefinition(const TagDecl *D) override
A new TagDecl definition was completed.
void AddedAttributeToRecord(const Attr *Attr, const RecordDecl *Record) override
An attribute was added to a RecordDecl.
void HandleImplicitImportDecl(ImportDecl *D) override
Handle an ImportDecl that was implicitly created due to an inclusion directive.
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override
Invoked when a function is implicitly instantiated.
bool HandleTopLevelDecl(DeclGroupRef D) override
HandleTopLevelDecl - Handle the specified top-level declaration.
void HandleTagDeclRequiredDefinition(const TagDecl *D) override
This callback is invoked the first time each TagDecl is required to be complete.
void AssignInheritanceModel(CXXRecordDecl *RD) override
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
void HandleTagDeclDefinition(TagDecl *D) override
HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.
std::unique_ptr< MultiplexASTDeserializationListener > DeserializationListener
std::unique_ptr< MultiplexASTMutationListener > MutationListener
void InitializeSema(Sema &S) override
Initialize the semantic consumer with the Sema instance being used to perform semantic analysis on th...
void HandleTranslationUnit(ASTContext &Ctx) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
void CompleteTentativeDefinition(VarDecl *D) override
CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...
void HandleInterestingDecl(DeclGroupRef D) override
HandleInterestingDecl - Handle the specified interesting declaration.
std::vector< std::unique_ptr< ASTConsumer > > Consumers
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
void CompleteExternalDeclaration(DeclaratorDecl *D) override
CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consume...
void HandleVTable(CXXRecordDecl *RD) override
Callback involved at the end of a translation unit to notify the consumer that a vtable for the given...
bool shouldSkipFunctionBody(Decl *D) override
This callback is called for each function if the Parser was initialized with SkipFunctionBodies set t...
ASTMutationListener * GetASTMutationListener() override
If the consumer is interested in entities getting modified after their initial creation,...
~MultiplexConsumer() override
void PrintStats() override
PrintStats - If desired, print any statistics.
void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override
Handle the specified top-level declaration that occurred inside and ObjC container.
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
MultiplexConsumer(std::vector< std::unique_ptr< ASTConsumer > > C)
void HandleInlineFunctionDefinition(FunctionDecl *D) override
This callback is invoked each time an inline (method or friend) function definition in a class is com...
void Initialize(ASTContext &Context) override
Initialize - This is called to initialize the consumer, providing the ASTContext.
This represents a decl that may have a name.
Represent a C++ namespace.
ObjCCategoryDecl - Represents a category declaration.
Represents an ObjC class declaration.
Represents a parameter to a function.
A (possibly-)qualified type.
Represents a struct/union/class.
Smart pointer class that efficiently represents Objective-C method names.
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
Represents the declaration of a struct/union/class/enum.
The top declaration context.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
A type index; the type ID with the qualifier bits removed.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
uint64_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
uint64_t MacroID
An ID number that refers to a macro in an AST file.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module 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.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ Delete
'delete' clause, allowed on the 'exit data' construct.
PredefinedDeclIDs
Predefined declaration IDs.