Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 1 | //===- ChainedIncludesSource.cpp - 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 | |
Chandler Carruth | 55fc873 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 15 | #include "clang/Basic/TargetInfo.h" |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 16 | #include "clang/Frontend/ASTUnit.h" |
Chandler Carruth | 55fc873 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 17 | #include "clang/Frontend/CompilerInstance.h" |
| 18 | #include "clang/Frontend/TextDiagnosticPrinter.h" |
| 19 | #include "clang/Lex/Preprocessor.h" |
| 20 | #include "clang/Parse/ParseAST.h" |
Chandler Carruth | 71088d1 | 2011-12-09 01:55:54 +0000 | [diff] [blame] | 21 | #include "clang/Serialization/ASTReader.h" |
| 22 | #include "clang/Serialization/ASTWriter.h" |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 23 | #include "llvm/Support/MemoryBuffer.h" |
| 24 | |
| 25 | using namespace clang; |
| 26 | |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame] | 27 | namespace { |
| 28 | class ChainedIncludesSource : public ExternalSemaSource { |
| 29 | public: |
| 30 | virtual ~ChainedIncludesSource(); |
| 31 | |
| 32 | ExternalSemaSource &getFinalReader() const { return *FinalReader; } |
| 33 | |
| 34 | std::vector<CompilerInstance *> CIs; |
| 35 | IntrusiveRefCntPtr<ExternalSemaSource> FinalReader; |
| 36 | |
| 37 | protected: |
| 38 | //===----------------------------------------------------------------------===// |
| 39 | // ExternalASTSource interface. |
| 40 | //===----------------------------------------------------------------------===// |
| 41 | |
| 42 | Decl *GetExternalDecl(uint32_t ID) override; |
| 43 | Selector GetExternalSelector(uint32_t ID) override; |
| 44 | uint32_t GetNumExternalSelectors() override; |
| 45 | Stmt *GetExternalDeclStmt(uint64_t Offset) override; |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 46 | CXXCtorInitializer **GetExternalCXXCtorInitializers(uint64_t Offset) override; |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame] | 47 | CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset) override; |
| 48 | bool FindExternalVisibleDeclsByName(const DeclContext *DC, |
| 49 | DeclarationName Name) override; |
| 50 | ExternalLoadResult |
| 51 | FindExternalLexicalDecls(const DeclContext *DC, |
| 52 | bool (*isKindWeWant)(Decl::Kind), |
| 53 | SmallVectorImpl<Decl *> &Result) override; |
| 54 | void CompleteType(TagDecl *Tag) override; |
| 55 | void CompleteType(ObjCInterfaceDecl *Class) override; |
| 56 | void StartedDeserializing() override; |
| 57 | void FinishedDeserializing() override; |
| 58 | void StartTranslationUnit(ASTConsumer *Consumer) override; |
| 59 | void PrintStats() override; |
| 60 | |
| 61 | /// Return the amount of memory used by memory buffers, breaking down |
| 62 | /// by heap-backed versus mmap'ed memory. |
| 63 | void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override; |
| 64 | |
| 65 | //===----------------------------------------------------------------------===// |
| 66 | // ExternalSemaSource interface. |
| 67 | //===----------------------------------------------------------------------===// |
| 68 | |
| 69 | void InitializeSema(Sema &S) override; |
| 70 | void ForgetSema() override; |
| 71 | void ReadMethodPool(Selector Sel) override; |
| 72 | bool LookupUnqualified(LookupResult &R, Scope *S) override; |
| 73 | }; |
| 74 | } |
| 75 | |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 76 | static ASTReader * |
| 77 | createASTReader(CompilerInstance &CI, StringRef pchFile, |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 78 | SmallVectorImpl<std::unique_ptr<llvm::MemoryBuffer>> &MemBufs, |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 79 | SmallVectorImpl<std::string> &bufNames, |
| 80 | ASTDeserializationListener *deserialListener = nullptr) { |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 81 | Preprocessor &PP = CI.getPreprocessor(); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 82 | std::unique_ptr<ASTReader> Reader; |
Douglas Gregor | f8a1e51 | 2011-09-02 00:26:20 +0000 | [diff] [blame] | 83 | Reader.reset(new ASTReader(PP, CI.getASTContext(), /*isysroot=*/"", |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 84 | /*DisableValidation=*/true)); |
Jonathan D. Turner | c24a1ee | 2011-08-02 17:40:32 +0000 | [diff] [blame] | 85 | for (unsigned ti = 0; ti < bufNames.size(); ++ti) { |
| 86 | StringRef sr(bufNames[ti]); |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 87 | Reader->addInMemoryBuffer(sr, std::move(MemBufs[ti])); |
Jonathan D. Turner | c24a1ee | 2011-08-02 17:40:32 +0000 | [diff] [blame] | 88 | } |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 89 | Reader->setDeserializationListener(deserialListener); |
Argyrios Kyrtzidis | 958bcaf | 2012-11-15 18:57:22 +0000 | [diff] [blame] | 90 | switch (Reader->ReadAST(pchFile, serialization::MK_PCH, SourceLocation(), |
Douglas Gregor | 38295be | 2012-10-22 23:51:00 +0000 | [diff] [blame] | 91 | ASTReader::ARR_None)) { |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 92 | case ASTReader::Success: |
| 93 | // Set the predefines buffer as suggested by the PCH reader. |
| 94 | PP.setPredefines(Reader->getSuggestedPredefines()); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 95 | return Reader.release(); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 96 | |
| 97 | case ASTReader::Failure: |
Douglas Gregor | 677e15f | 2013-03-19 00:28:20 +0000 | [diff] [blame] | 98 | case ASTReader::Missing: |
Douglas Gregor | 4825fd7 | 2012-10-22 22:50:17 +0000 | [diff] [blame] | 99 | case ASTReader::OutOfDate: |
| 100 | case ASTReader::VersionMismatch: |
| 101 | case ASTReader::ConfigurationMismatch: |
| 102 | case ASTReader::HadErrors: |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 103 | break; |
| 104 | } |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 105 | return nullptr; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | ChainedIncludesSource::~ChainedIncludesSource() { |
| 109 | for (unsigned i = 0, e = CIs.size(); i != e; ++i) |
| 110 | delete CIs[i]; |
| 111 | } |
| 112 | |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame] | 113 | IntrusiveRefCntPtr<ExternalSemaSource> clang::createChainedIncludesSource( |
| 114 | CompilerInstance &CI, IntrusiveRefCntPtr<ExternalSemaSource> &Reader) { |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 115 | |
| 116 | std::vector<std::string> &includes = CI.getPreprocessorOpts().ChainedIncludes; |
| 117 | assert(!includes.empty() && "No '-chain-include' in options!"); |
| 118 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 119 | IntrusiveRefCntPtr<ChainedIncludesSource> source(new ChainedIncludesSource()); |
Argyrios Kyrtzidis | 8616f9a | 2012-11-09 19:40:39 +0000 | [diff] [blame] | 120 | InputKind IK = CI.getFrontendOpts().Inputs[0].getKind(); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 121 | |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 122 | SmallVector<std::unique_ptr<llvm::MemoryBuffer>, 4> SerialBufs; |
Jonathan D. Turner | c24a1ee | 2011-08-02 17:40:32 +0000 | [diff] [blame] | 123 | SmallVector<std::string, 4> serialBufNames; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 124 | |
| 125 | for (unsigned i = 0, e = includes.size(); i != e; ++i) { |
| 126 | bool firstInclude = (i == 0); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 127 | std::unique_ptr<CompilerInvocation> CInvok; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 128 | CInvok.reset(new CompilerInvocation(CI.getInvocation())); |
| 129 | |
| 130 | CInvok->getPreprocessorOpts().ChainedIncludes.clear(); |
| 131 | CInvok->getPreprocessorOpts().ImplicitPCHInclude.clear(); |
| 132 | CInvok->getPreprocessorOpts().ImplicitPTHInclude.clear(); |
| 133 | CInvok->getPreprocessorOpts().DisablePCHValidation = true; |
| 134 | CInvok->getPreprocessorOpts().Includes.clear(); |
| 135 | CInvok->getPreprocessorOpts().MacroIncludes.clear(); |
| 136 | CInvok->getPreprocessorOpts().Macros.clear(); |
| 137 | |
| 138 | CInvok->getFrontendOpts().Inputs.clear(); |
Argyrios Kyrtzidis | 8e1fbbc | 2012-11-09 19:40:33 +0000 | [diff] [blame] | 139 | FrontendInputFile InputFile(includes[i], IK); |
| 140 | CInvok->getFrontendOpts().Inputs.push_back(InputFile); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 141 | |
| 142 | TextDiagnosticPrinter *DiagClient = |
Douglas Gregor | 02c23eb | 2012-10-23 22:26:28 +0000 | [diff] [blame] | 143 | new TextDiagnosticPrinter(llvm::errs(), new DiagnosticOptions()); |
Dylan Noblesmith | c93dc78 | 2012-02-20 14:00:23 +0000 | [diff] [blame] | 144 | IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); |
| 145 | IntrusiveRefCntPtr<DiagnosticsEngine> Diags( |
Douglas Gregor | 02c23eb | 2012-10-23 22:26:28 +0000 | [diff] [blame] | 146 | new DiagnosticsEngine(DiagID, &CI.getDiagnosticOpts(), DiagClient)); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 147 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 148 | std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); |
| 149 | Clang->setInvocation(CInvok.release()); |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame] | 150 | Clang->setDiagnostics(Diags.get()); |
| 151 | Clang->setTarget(TargetInfo::CreateTargetInfo( |
| 152 | Clang->getDiagnostics(), Clang->getInvocation().TargetOpts)); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 153 | Clang->createFileManager(); |
| 154 | Clang->createSourceManager(Clang->getFileManager()); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 155 | Clang->createPreprocessor(TU_Prefix); |
Sebastian Redl | 0ab547c | 2011-03-31 19:29:18 +0000 | [diff] [blame] | 156 | Clang->getDiagnosticClient().BeginSourceFile(Clang->getLangOpts(), |
| 157 | &Clang->getPreprocessor()); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 158 | Clang->createASTContext(); |
| 159 | |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 160 | SmallVector<char, 256> serialAST; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 161 | llvm::raw_svector_ostream OS(serialAST); |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 162 | auto consumer = |
| 163 | llvm::make_unique<PCHGenerator>(Clang->getPreprocessor(), "-", nullptr, |
| 164 | /*isysroot=*/"", &OS); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 165 | Clang->getASTContext().setASTMutationListener( |
| 166 | consumer->GetASTMutationListener()); |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 167 | Clang->setASTConsumer(std::move(consumer)); |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 168 | Clang->createSema(TU_Prefix, nullptr); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 169 | |
| 170 | if (firstInclude) { |
| 171 | Preprocessor &PP = Clang->getPreprocessor(); |
| 172 | PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(), |
David Blaikie | 4e4d084 | 2012-03-11 07:00:24 +0000 | [diff] [blame] | 173 | PP.getLangOpts()); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 174 | } else { |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 175 | assert(!SerialBufs.empty()); |
| 176 | SmallVector<std::unique_ptr<llvm::MemoryBuffer>, 4> Bufs; |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame] | 177 | // TODO: Pass through the existing MemoryBuffer instances instead of |
| 178 | // allocating new ones. |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 179 | for (auto &SB : SerialBufs) |
| 180 | Bufs.push_back(llvm::MemoryBuffer::getMemBuffer(SB->getBuffer())); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 181 | std::string pchName = includes[i-1]; |
| 182 | llvm::raw_string_ostream os(pchName); |
| 183 | os << ".pch" << i-1; |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame] | 184 | serialBufNames.push_back(os.str()); |
Jonathan D. Turner | c24a1ee | 2011-08-02 17:40:32 +0000 | [diff] [blame] | 185 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 186 | IntrusiveRefCntPtr<ASTReader> Reader; |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 187 | Reader = createASTReader( |
| 188 | *Clang, pchName, Bufs, serialBufNames, |
| 189 | Clang->getASTConsumer().GetASTDeserializationListener()); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 190 | if (!Reader) |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 191 | return nullptr; |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 192 | Clang->setModuleManager(Reader); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 193 | Clang->getASTContext().setExternalSource(Reader); |
| 194 | } |
| 195 | |
Argyrios Kyrtzidis | 8e1fbbc | 2012-11-09 19:40:33 +0000 | [diff] [blame] | 196 | if (!Clang->InitializeSourceManager(InputFile)) |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 197 | return nullptr; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 198 | |
| 199 | ParseAST(Clang->getSema()); |
Sebastian Redl | 0ab547c | 2011-03-31 19:29:18 +0000 | [diff] [blame] | 200 | Clang->getDiagnosticClient().EndSourceFile(); |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 201 | SerialBufs.push_back(llvm::MemoryBuffer::getMemBufferCopy(OS.str())); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 202 | source->CIs.push_back(Clang.release()); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 203 | } |
| 204 | |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 205 | assert(!SerialBufs.empty()); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 206 | std::string pchName = includes.back() + ".pch-final"; |
Jonathan D. Turner | c24a1ee | 2011-08-02 17:40:32 +0000 | [diff] [blame] | 207 | serialBufNames.push_back(pchName); |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 208 | Reader = createASTReader(CI, pchName, SerialBufs, serialBufNames); |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 209 | if (!Reader) |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 210 | return nullptr; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 211 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 212 | source->FinalReader = Reader; |
| 213 | return source; |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | //===----------------------------------------------------------------------===// |
| 217 | // ExternalASTSource interface. |
| 218 | //===----------------------------------------------------------------------===// |
| 219 | |
| 220 | Decl *ChainedIncludesSource::GetExternalDecl(uint32_t ID) { |
| 221 | return getFinalReader().GetExternalDecl(ID); |
| 222 | } |
| 223 | Selector ChainedIncludesSource::GetExternalSelector(uint32_t ID) { |
| 224 | return getFinalReader().GetExternalSelector(ID); |
| 225 | } |
| 226 | uint32_t ChainedIncludesSource::GetNumExternalSelectors() { |
| 227 | return getFinalReader().GetNumExternalSelectors(); |
| 228 | } |
| 229 | Stmt *ChainedIncludesSource::GetExternalDeclStmt(uint64_t Offset) { |
| 230 | return getFinalReader().GetExternalDeclStmt(Offset); |
| 231 | } |
| 232 | CXXBaseSpecifier * |
| 233 | ChainedIncludesSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { |
| 234 | return getFinalReader().GetExternalCXXBaseSpecifiers(Offset); |
| 235 | } |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 236 | CXXCtorInitializer ** |
| 237 | ChainedIncludesSource::GetExternalCXXCtorInitializers(uint64_t Offset) { |
| 238 | return getFinalReader().GetExternalCXXCtorInitializers(Offset); |
| 239 | } |
Richard Smith | 3646c68 | 2013-02-07 03:30:24 +0000 | [diff] [blame] | 240 | bool |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 241 | ChainedIncludesSource::FindExternalVisibleDeclsByName(const DeclContext *DC, |
| 242 | DeclarationName Name) { |
| 243 | return getFinalReader().FindExternalVisibleDeclsByName(DC, Name); |
| 244 | } |
Douglas Gregor | ba6ffaf | 2011-07-15 21:46:17 +0000 | [diff] [blame] | 245 | ExternalLoadResult |
| 246 | ChainedIncludesSource::FindExternalLexicalDecls(const DeclContext *DC, |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 247 | bool (*isKindWeWant)(Decl::Kind), |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 248 | SmallVectorImpl<Decl*> &Result) { |
Argyrios Kyrtzidis | b0f4b9a | 2011-03-09 17:21:42 +0000 | [diff] [blame] | 249 | return getFinalReader().FindExternalLexicalDecls(DC, isKindWeWant, Result); |
| 250 | } |
| 251 | void ChainedIncludesSource::CompleteType(TagDecl *Tag) { |
| 252 | return getFinalReader().CompleteType(Tag); |
| 253 | } |
| 254 | void ChainedIncludesSource::CompleteType(ObjCInterfaceDecl *Class) { |
| 255 | return getFinalReader().CompleteType(Class); |
| 256 | } |
| 257 | void ChainedIncludesSource::StartedDeserializing() { |
| 258 | return getFinalReader().StartedDeserializing(); |
| 259 | } |
| 260 | void ChainedIncludesSource::FinishedDeserializing() { |
| 261 | return getFinalReader().FinishedDeserializing(); |
| 262 | } |
| 263 | void ChainedIncludesSource::StartTranslationUnit(ASTConsumer *Consumer) { |
| 264 | return getFinalReader().StartTranslationUnit(Consumer); |
| 265 | } |
| 266 | void ChainedIncludesSource::PrintStats() { |
| 267 | return getFinalReader().PrintStats(); |
| 268 | } |
Ted Kremenek | e9b5f3d | 2011-04-28 23:46:20 +0000 | [diff] [blame] | 269 | void ChainedIncludesSource::getMemoryBufferSizes(MemoryBufferSizes &sizes)const{ |
| 270 | for (unsigned i = 0, e = CIs.size(); i != e; ++i) { |
| 271 | if (const ExternalASTSource *eSrc = |
| 272 | CIs[i]->getASTContext().getExternalSource()) { |
| 273 | eSrc->getMemoryBufferSizes(sizes); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | getFinalReader().getMemoryBufferSizes(sizes); |
| 278 | } |
Sebastian Redl | ce0682f | 2011-03-31 19:29:24 +0000 | [diff] [blame] | 279 | |
| 280 | void ChainedIncludesSource::InitializeSema(Sema &S) { |
| 281 | return getFinalReader().InitializeSema(S); |
| 282 | } |
| 283 | void ChainedIncludesSource::ForgetSema() { |
| 284 | return getFinalReader().ForgetSema(); |
| 285 | } |
Douglas Gregor | 5ac4b69 | 2012-01-25 00:49:42 +0000 | [diff] [blame] | 286 | void ChainedIncludesSource::ReadMethodPool(Selector Sel) { |
| 287 | getFinalReader().ReadMethodPool(Sel); |
Sebastian Redl | ce0682f | 2011-03-31 19:29:24 +0000 | [diff] [blame] | 288 | } |
| 289 | bool ChainedIncludesSource::LookupUnqualified(LookupResult &R, Scope *S) { |
| 290 | return getFinalReader().LookupUnqualified(R, S); |
| 291 | } |
| 292 | |