clang  3.7.0
MultiplexConsumer.h
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 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_FRONTEND_MULTIPLEXCONSUMER_H
16 #define LLVM_CLANG_FRONTEND_MULTIPLEXCONSUMER_H
17 
18 #include "clang/Basic/LLVM.h"
20 #include <memory>
21 #include <vector>
22 
23 namespace clang {
24 
25 class MultiplexASTMutationListener;
26 class MultiplexASTDeserializationListener;
27 
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;
34 
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 HandleLinkerOptionPragma(llvm::StringRef Opts) override;
48  void HandleDetectMismatch(llvm::StringRef Name,
49  llvm::StringRef Value) override;
50  void HandleDependentLibrary(llvm::StringRef Lib) override;
51  void CompleteTentativeDefinition(VarDecl *D) override;
52  void HandleVTable(CXXRecordDecl *RD) override;
55  void PrintStats() override;
56 
57  // SemaConsumer
58  void InitializeSema(Sema &S) override;
59  void ForgetSema() override;
60 
61 private:
62  std::vector<std::unique_ptr<ASTConsumer>> Consumers; // Owns these.
63  std::unique_ptr<MultiplexASTMutationListener> MutationListener;
64  std::unique_ptr<MultiplexASTDeserializationListener> DeserializationListener;
65 };
66 
67 } // end namespace clang
68 
69 #endif
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. The default implementation ignored them.
void HandleDependentLibrary(llvm::StringRef Lib) override
Handle a dependent library created by a pragma in the source. Currently this only exists to support M...
void HandleVTable(CXXRecordDecl *RD) override
Callback involved at the end of a translation unit to notify the consumer that a vtable for the given...
void CompleteTentativeDefinition(VarDecl *D) override
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
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
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:258
ASTContext * Context
void Initialize(ASTContext &Context) override
void HandleTagDeclDefinition(TagDecl *D) override
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
void HandleInterestingDecl(DeclGroupRef D) override
void HandleLinkerOptionPragma(llvm::StringRef Opts) override
Handle a pragma that appends to Linker Options. Currently this only exists to support Microsoft's #pr...
void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override
Invoked when a function is implicitly instantiated. Note that at this point point it does not have a ...
void HandleDetectMismatch(llvm::StringRef Name, llvm::StringRef Value) override
Handle a pragma that emits a mismatch identifier and value to the object file for the linker to work ...
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2694
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1717
void HandleImplicitImportDecl(ImportDecl *D) override
Handle an ImportDecl that was implicitly created due to an inclusion directive. The default implement...
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:3704
void InitializeSema(Sema &S) override
Initialize the semantic consumer with the Sema instance being used to perform semantic analysis on th...
void HandleInlineMethodDefinition(CXXMethodDecl *D) override
This callback is invoked each time an inline method definition is completed.
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
void HandleTranslationUnit(ASTContext &Ctx) override
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.