• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- ChainedIncludesSource.h - Chained PCHs in Memory ---------*- 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 defines the ChainedIncludesSource class, which converts headers
11 //  to chained PCHs in memory, mainly used for testing.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_SERIALIZATION_CHAINEDINCLUDESSOURCE_H
15 #define LLVM_CLANG_SERIALIZATION_CHAINEDINCLUDESSOURCE_H
16 
17 #include "clang/Sema/ExternalSemaSource.h"
18 #include <vector>
19 
20 namespace clang {
21   class CompilerInstance;
22 
23 class ChainedIncludesSource : public ExternalSemaSource {
24 public:
25   virtual ~ChainedIncludesSource();
26 
27   static ChainedIncludesSource *create(CompilerInstance &CI);
28 
29 private:
getFinalReader()30   ExternalSemaSource &getFinalReader() const { return *FinalReader; }
31 
32   std::vector<CompilerInstance *> CIs;
33   OwningPtr<ExternalSemaSource> FinalReader;
34 
35 
36 protected:
37 
38 //===----------------------------------------------------------------------===//
39 // ExternalASTSource interface.
40 //===----------------------------------------------------------------------===//
41 
42   virtual Decl *GetExternalDecl(uint32_t ID);
43   virtual Selector GetExternalSelector(uint32_t ID);
44   virtual uint32_t GetNumExternalSelectors();
45   virtual Stmt *GetExternalDeclStmt(uint64_t Offset);
46   virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset);
47   virtual DeclContextLookupResult
48   FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name);
49   virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
50                                         bool (*isKindWeWant)(Decl::Kind),
51                                         SmallVectorImpl<Decl*> &Result);
52   virtual void CompleteType(TagDecl *Tag);
53   virtual void CompleteType(ObjCInterfaceDecl *Class);
54   virtual void StartedDeserializing();
55   virtual void FinishedDeserializing();
56   virtual void StartTranslationUnit(ASTConsumer *Consumer);
57   virtual void PrintStats();
58 
59   /// Return the amount of memory used by memory buffers, breaking down
60   /// by heap-backed versus mmap'ed memory.
61   virtual void getMemoryBufferSizes(MemoryBufferSizes &sizes) const;
62 
63 //===----------------------------------------------------------------------===//
64 // ExternalSemaSource interface.
65 //===----------------------------------------------------------------------===//
66 
67   virtual void InitializeSema(Sema &S);
68   virtual void ForgetSema();
69   virtual void ReadMethodPool(Selector Sel);
70   virtual bool LookupUnqualified(LookupResult &R, Scope *S);
71 };
72 
73 }
74 
75 #endif
76