diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/PCHWriter.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/ParseAST.cpp | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp index 6aea7a53727..afe77aebf8f 100644 --- a/clang/lib/Frontend/PCHWriter.cpp +++ b/clang/lib/Frontend/PCHWriter.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/PCHWriter.h" +#include "../Sema/Sema.h" // FIXME: move header into include/clang/Sema #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclContextInternals.h" @@ -1760,7 +1761,10 @@ void PCHWriter::AddString(const std::string &Str, RecordData &Record) { PCHWriter::PCHWriter(llvm::BitstreamWriter &Stream) : Stream(Stream), NextTypeID(pch::NUM_PREDEF_TYPE_IDS), NumStatements(0) { } -void PCHWriter::WritePCH(ASTContext &Context, const Preprocessor &PP) { +void PCHWriter::WritePCH(Sema &SemaRef) { + ASTContext &Context = SemaRef.Context; + Preprocessor &PP = SemaRef.PP; + // Emit the file header. Stream.Emit((unsigned)'C', 8); Stream.Emit((unsigned)'P', 8); diff --git a/clang/lib/Sema/ParseAST.cpp b/clang/lib/Sema/ParseAST.cpp index b27734745ae..448556092f6 100644 --- a/clang/lib/Sema/ParseAST.cpp +++ b/clang/lib/Sema/ParseAST.cpp @@ -13,6 +13,7 @@ #include "clang/Sema/ParseAST.h" #include "Sema.h" +#include "clang/Sema/SemaConsumer.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Stmt.h" @@ -46,6 +47,9 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer, Consumer->Initialize(Ctx); + if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer)) + SC->InitializeSema(S); + if (Ctx.getExternalSource()) Ctx.getExternalSource()->StartTranslationUnit(Consumer); |