diff options
Diffstat (limited to 'lib/Frontend/GeneratePCH.cpp')
-rw-r--r-- | lib/Frontend/GeneratePCH.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/Frontend/GeneratePCH.cpp b/lib/Frontend/GeneratePCH.cpp index 8be88ce381..3b7715ad28 100644 --- a/lib/Frontend/GeneratePCH.cpp +++ b/lib/Frontend/GeneratePCH.cpp @@ -32,19 +32,24 @@ using namespace llvm; namespace { class VISIBILITY_HIDDEN PCHGenerator : public SemaConsumer { const Preprocessor &PP; + const char *isysroot; llvm::raw_ostream *Out; Sema *SemaPtr; MemorizeStatCalls *StatCalls; // owned by the FileManager - + public: - explicit PCHGenerator(const Preprocessor &PP, llvm::raw_ostream *Out); + explicit PCHGenerator(const Preprocessor &PP, + const char *isysroot, + llvm::raw_ostream *Out); virtual void InitializeSema(Sema &S) { SemaPtr = &S; } virtual void HandleTranslationUnit(ASTContext &Ctx); }; } -PCHGenerator::PCHGenerator(const Preprocessor &PP, llvm::raw_ostream *OS) - : PP(PP), Out(OS), SemaPtr(0), StatCalls(0) { +PCHGenerator::PCHGenerator(const Preprocessor &PP, + const char *isysroot, + llvm::raw_ostream *OS) + : PP(PP), isysroot(isysroot), Out(OS), SemaPtr(0), StatCalls(0) { // Install a stat() listener to keep track of all of the stat() // calls. @@ -56,14 +61,14 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) { if (PP.getDiagnostics().hasErrorOccurred()) return; - // Write the PCH contents into a buffer + // Write the PCH contents into a buffer std::vector<unsigned char> Buffer; BitstreamWriter Stream(Buffer); PCHWriter Writer(Stream); // Emit the PCH file assert(SemaPtr && "No Sema?"); - Writer.WritePCH(*SemaPtr, StatCalls); + Writer.WritePCH(*SemaPtr, StatCalls, isysroot); // Write the generated bitstream to "Out". Out->write((char *)&Buffer.front(), Buffer.size()); @@ -73,6 +78,7 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) { } ASTConsumer *clang::CreatePCHGenerator(const Preprocessor &PP, - llvm::raw_ostream *OS) { - return new PCHGenerator(PP, OS); + llvm::raw_ostream *OS, + const char *isysroot) { + return new PCHGenerator(PP, isysroot, OS); } |