StringRef InFile,
std::string &Sysroot,
std::string &OutputFile,
- raw_ostream *&OS,
- bool &Chaining);
+ raw_ostream *&OS);
};
class SyntaxOnlyAction : public ASTFrontendAction {
std::vector<unsigned char> Buffer;
llvm::BitstreamWriter Stream;
ASTWriter Writer;
- bool Chaining;
protected:
ASTWriter &getWriter() { return Writer; }
public:
PCHGenerator(const Preprocessor &PP, StringRef OutputFile,
- bool Chaining, StringRef isysroot, raw_ostream *Out);
+ StringRef isysroot, raw_ostream *Out);
~PCHGenerator();
virtual void InitializeSema(Sema &S) { SemaPtr = &S; }
virtual void HandleTranslationUnit(ASTContext &Ctx);
std::vector<Decl *> TopLevelDecls;
public:
- PrecompilePreambleConsumer(ASTUnit &Unit,
- const Preprocessor &PP, bool Chaining,
+ PrecompilePreambleConsumer(ASTUnit &Unit, const Preprocessor &PP,
StringRef isysroot, raw_ostream *Out)
- : PCHGenerator(PP, "", Chaining, isysroot, Out), Unit(Unit),
+ : PCHGenerator(PP, "", isysroot, Out), Unit(Unit),
Hash(Unit.getCurrentTopLevelHashValue()) {
Hash = 0;
}
std::string Sysroot;
std::string OutputFile;
raw_ostream *OS = 0;
- bool Chaining;
if (GeneratePCHAction::ComputeASTConsumerArguments(CI, InFile, Sysroot,
OutputFile,
- OS, Chaining))
+ OS))
return 0;
if (!CI.getFrontendOpts().RelocatablePCH)
CI.getPreprocessor().addPPCallbacks(
new MacroDefinitionTrackerPPCallbacks(Unit.getCurrentTopLevelHashValue()));
- return new PrecompilePreambleConsumer(Unit, CI.getPreprocessor(), Chaining,
- Sysroot, OS);
+ return new PrecompilePreambleConsumer(Unit, CI.getPreprocessor(), Sysroot,
+ OS);
}
virtual bool hasCodeCompletionSupport() const { return false; }
std::string Sysroot;
std::string OutputFile;
raw_ostream *OS = 0;
- bool Chaining;
- if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS,
- Chaining))
+ if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS))
return 0;
if (!CI.getFrontendOpts().RelocatablePCH)
Sysroot.clear();
- return new PCHGenerator(CI.getPreprocessor(), OutputFile, Chaining, Sysroot,
- OS);
+ return new PCHGenerator(CI.getPreprocessor(), OutputFile, Sysroot, OS);
}
bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI,
StringRef InFile,
std::string &Sysroot,
std::string &OutputFile,
- raw_ostream *&OS,
- bool &Chaining) {
+ raw_ostream *&OS) {
Sysroot = CI.getHeaderSearchOpts().Sysroot;
if (CI.getFrontendOpts().RelocatablePCH && Sysroot.empty()) {
CI.getDiagnostics().Report(diag::err_relocatable_without_isysroot);
return true;
OutputFile = CI.getFrontendOpts().OutputFile;
- Chaining = CI.getInvocation().getFrontendOpts().ChainedPCH &&
- !CI.getPreprocessorOpts().ImplicitPCHInclude.empty();
return false;
}
llvm::raw_svector_ostream OS(serialAST);
llvm::OwningPtr<ASTConsumer> consumer;
consumer.reset(new PCHGenerator(Clang->getPreprocessor(), "-",
- /*Chaining=*/!firstInclude,
/*isysroot=*/"", &OS));
Clang->getASTContext().setASTMutationListener(
consumer->GetASTMutationListener());
PCHGenerator::PCHGenerator(const Preprocessor &PP,
StringRef OutputFile,
- bool Chaining,
StringRef isysroot,
raw_ostream *OS)
: PP(PP), OutputFile(OutputFile), isysroot(isysroot.str()), Out(OS),
- SemaPtr(0), StatCalls(0), Stream(Buffer), Writer(Stream), Chaining(Chaining) {
+ SemaPtr(0), StatCalls(0), Stream(Buffer), Writer(Stream) {
// Install a stat() listener to keep track of all of the stat()
// calls.
StatCalls = new MemorizeStatCalls();
- // If we have a chain, we want new stat calls only, so install the memorizer
- // *after* the already installed ASTReader's stat cache.
- PP.getFileManager().addStatCache(StatCalls,
- /*AtBeginning=*/!Chaining);
+ PP.getFileManager().addStatCache(StatCalls, /*AtBeginning=*/false);
}
PCHGenerator::~PCHGenerator() {
}
ASTMutationListener *PCHGenerator::GetASTMutationListener() {
- if (Chaining)
- return &Writer;
- return 0;
+ return &Writer;
}
ASTSerializationListener *PCHGenerator::GetASTSerializationListener() {