21 #include "llvm/Bitcode/BitstreamWriter.h"
24 using namespace clang;
28 std::shared_ptr<PCHBuffer> Buffer,
29 bool AllowASTWithErrors)
30 : PP(PP), OutputFile(OutputFile), Module(Module), isysroot(isysroot.str()),
31 SemaPtr(nullptr), Buffer(Buffer), Stream(Buffer->Data), Writer(Stream),
32 AllowASTWithErrors(AllowASTWithErrors) {
33 Buffer->IsComplete =
false;
45 if (hasErrors && !AllowASTWithErrors)
49 assert(SemaPtr &&
"No Sema?");
50 Writer.
WriteAST(*SemaPtr, OutputFile,
Module, isysroot, hasErrors);
52 Buffer->IsComplete =
true;
Defines the clang::ASTContext interface.
Defines the clang::FileManager interface and associated types.
bool hasErrorOccurred() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void HandleTranslationUnit(ASTContext &Ctx) override
Describes a module or submodule.
void WriteAST(Sema &SemaRef, const std::string &OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false)
Write a precompiled header for the given semantic analysis.
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
Defines the clang::Preprocessor interface.
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with this preprocessor.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
PCHGenerator(const Preprocessor &PP, StringRef OutputFile, clang::Module *Module, StringRef isysroot, std::shared_ptr< PCHBuffer > Buffer, bool AllowASTWithErrors=false)
DiagnosticsEngine & getDiagnostics() const
ASTMutationListener * GetASTMutationListener() override
If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.