diff options
-rw-r--r-- | include/clang/Serialization/ASTWriter.h | 1 | ||||
-rw-r--r-- | lib/Serialization/GeneratePCH.cpp | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 4e2583db1e..1c5e365a23 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -632,6 +632,7 @@ protected: public: PCHGenerator(const Preprocessor &PP, const std::string &OutputFile, bool Chaining, const char *isysroot, raw_ostream *Out); + ~PCHGenerator(); virtual void InitializeSema(Sema &S) { SemaPtr = &S; } virtual void HandleTranslationUnit(ASTContext &Ctx); virtual ASTMutationListener *GetASTMutationListener(); diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp index b8833ceacc..9cd694e05c 100644 --- a/lib/Serialization/GeneratePCH.cpp +++ b/lib/Serialization/GeneratePCH.cpp @@ -23,6 +23,8 @@ #include "llvm/Bitcode/BitstreamWriter.h" #include "llvm/Support/raw_ostream.h" #include <string> +#include <string.h> +#include <stdlib.h> using namespace clang; @@ -31,7 +33,7 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP, bool Chaining, const char *isysroot, llvm::raw_ostream *OS) - : PP(PP), OutputFile(OutputFile), isysroot(isysroot), Out(OS), SemaPtr(0), + : PP(PP), OutputFile(OutputFile), isysroot(0), Out(OS), SemaPtr(0), StatCalls(0), Stream(Buffer), Writer(Stream), Chaining(Chaining) { // Install a stat() listener to keep track of all of the stat() // calls. @@ -40,6 +42,13 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP, // *after* the already installed ASTReader's stat cache. PP.getFileManager().addStatCache(StatCalls, /*AtBeginning=*/!Chaining); + + if (isysroot) + this->isysroot = strdup(isysroot); +} + +PCHGenerator::~PCHGenerator() { + free((void*)isysroot); } void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) { |