clang  7.0.0svn
Go to the documentation of this file.
1 //===-- MultiplexConsumer.h - AST Consumer for PCH Generation ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the MultiplexConsumer class, which can be used to
11 // multiplex ASTConsumer and SemaConsumer messages to many consumers.
12 //
13 //===----------------------------------------------------------------------===//
18 #include "clang/Basic/LLVM.h"
20 #include <memory>
21 #include <vector>
23 namespace clang {
25 class MultiplexASTMutationListener;
26 class MultiplexASTDeserializationListener;
28 // Has a list of ASTConsumers and calls each of them. Owns its children.
30 public:
31  // Takes ownership of the pointers in C.
32  MultiplexConsumer(std::vector<std::unique_ptr<ASTConsumer>> C);
33  ~MultiplexConsumer() override;
35  // ASTConsumer
36  void Initialize(ASTContext &Context) override;
38  bool HandleTopLevelDecl(DeclGroupRef D) override;
40  void HandleInterestingDecl(DeclGroupRef D) override;
41  void HandleTranslationUnit(ASTContext &Ctx) override;
42  void HandleTagDeclDefinition(TagDecl *D) override;
43  void HandleTagDeclRequiredDefinition(const TagDecl *D) override;
46  void HandleImplicitImportDecl(ImportDecl *D) override;
47  void CompleteTentativeDefinition(VarDecl *D) override;
48  void AssignInheritanceModel(CXXRecordDecl *RD) override;
49  void HandleVTable(CXXRecordDecl *RD) override;
52  void PrintStats() override;
53  bool shouldSkipFunctionBody(Decl *D) override;
55  // SemaConsumer
56  void InitializeSema(Sema &S) override;
57  void ForgetSema() override;
59 private:
60  std::vector<std::unique_ptr<ASTConsumer>> Consumers; // Owns these.
61  std::unique_ptr<MultiplexASTMutationListener> MutationListener;
62  std::unique_ptr<MultiplexASTDeserializationListener> DeserializationListener;
63 };
65 } // end namespace clang
67 #endif
Represents a function declaration or definition.
Definition: Decl.h:1696
ASTMutationListener * GetASTMutationListener() override
If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here.
void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override
Handle the specified top-level declaration that occurred inside and ObjC container.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
void HandleInlineFunctionDefinition(FunctionDecl *D) override
This callback is invoked each time an inline (method or friend) function definition in a class is com...
void HandleVTable(CXXRecordDecl *RD) override
Callback involved at the end of a translation unit to notify the consumer that a vtable for the given...
Represents a variable declaration or definition.
Definition: Decl.h:812
void CompleteTentativeDefinition(VarDecl *D) override
CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:149
void PrintStats() override
PrintStats - If desired, print any statistics.
An abstract interface that should be implemented by clients that read ASTs and then require further s...
Definition: SemaConsumer.h:26
bool HandleTopLevelDecl(DeclGroupRef D) override
HandleTopLevelDecl - Handle the specified top-level declaration.
MultiplexConsumer(std::vector< std::unique_ptr< ASTConsumer >> C)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
void HandleTagDeclRequiredDefinition(const TagDecl *D) override
This callback is invoked the first time each TagDecl is required to be complete.
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:274
void Initialize(ASTContext &Context) override
Initialize - This is called to initialize the consumer, providing the ASTContext. ...
void HandleTagDeclDefinition(TagDecl *D) override
HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
void HandleInterestingDecl(DeclGroupRef D) override
HandleInterestingDecl - Handle the specified interesting declaration.
void AssignInheritanceModel(CXXRecordDecl *RD) override
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override
Invoked when a function is implicitly instantiated.
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2983
void HandleImplicitImportDecl(ImportDecl *D) override
Handle an ImportDecl that was implicitly created due to an inclusion directive.
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4058
Dataflow Directional Tag Classes.
void InitializeSema(Sema &S) override
Initialize the semantic consumer with the Sema instance being used to perform semantic analysis on th...
Represents a C++ struct/union/class.
Definition: DeclCXX.h:299
void HandleTranslationUnit(ASTContext &Ctx) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
bool shouldSkipFunctionBody(Decl *D) override
This callback is called for each function if the Parser was initialized with SkipFunctionBodies set t...
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.