]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/tools/clang/include/clang/Frontend/MultiplexConsumer.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / tools / clang / include / clang / Frontend / MultiplexConsumer.h
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 CLANG_FRONTEND_MULTIPLEXCONSUMER_H
16 #define CLANG_FRONTEND_MULTIPLEXCONSUMER_H
17
18 #include "clang/Sema/SemaConsumer.h"
19 #include "llvm/ADT/OwningPtr.h"
20 #include <vector>
21
22 namespace clang {
23
24 class MultiplexASTMutationListener;
25 class MultiplexASTDeserializationListener;
26
27 // Has a list of ASTConsumers and calls each of them. Owns its children.
28 class MultiplexConsumer : public SemaConsumer {
29 public:
30   // Takes ownership of the pointers in C.
31   MultiplexConsumer(const std::vector<ASTConsumer*>& C);
32   ~MultiplexConsumer();
33
34   // ASTConsumer
35   virtual void Initialize(ASTContext &Context);
36   virtual void HandleTopLevelDecl(DeclGroupRef D);
37   virtual void HandleInterestingDecl(DeclGroupRef D);
38   virtual void HandleTranslationUnit(ASTContext &Ctx);
39   virtual void HandleTagDeclDefinition(TagDecl *D);
40   virtual void CompleteTentativeDefinition(VarDecl *D);
41   virtual void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired);
42   virtual ASTMutationListener *GetASTMutationListener();
43   virtual ASTDeserializationListener *GetASTDeserializationListener();
44   virtual void PrintStats();
45
46   // SemaConsumer
47   virtual void InitializeSema(Sema &S);
48   virtual void ForgetSema();
49
50   static bool classof(const MultiplexConsumer *) { return true; }
51 private:
52   std::vector<ASTConsumer*> Consumers;  // Owns these.
53   llvm::OwningPtr<MultiplexASTMutationListener> MutationListener;
54   llvm::OwningPtr<MultiplexASTDeserializationListener> DeserializationListener;
55 };
56
57 }  // end namespace clang
58
59 #endif