aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/GeneratePCH.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend/GeneratePCH.cpp')
-rw-r--r--lib/Frontend/GeneratePCH.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Frontend/GeneratePCH.cpp b/lib/Frontend/GeneratePCH.cpp
index 8be88ce38117..bc45cc422585 100644
--- a/lib/Frontend/GeneratePCH.cpp
+++ b/lib/Frontend/GeneratePCH.cpp
@@ -23,7 +23,6 @@
#include "llvm/System/Path.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/Streams.h"
#include <string>
using namespace clang;
@@ -32,19 +31,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 +60,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 +77,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);
}