19#include "llvm/Bitstream/BitstreamWriter.h"
25 StringRef OutputFile, StringRef isysroot, std::shared_ptr<PCHBuffer> Buffer,
26 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
27 bool AllowASTWithErrors,
bool IncludeTimestamps,
28 bool ShouldCacheASTInMemory)
29 : PP(PP), OutputFile(OutputFile), isysroot(isysroot.str()),
30 SemaPtr(nullptr), Buffer(
std::move(Buffer)), Stream(this->Buffer->
Data),
31 Writer(Stream, this->Buffer->
Data, ModuleCache, Extensions,
33 AllowASTWithErrors(AllowASTWithErrors),
34 ShouldCacheASTInMemory(ShouldCacheASTInMemory) {
35 this->Buffer->IsComplete =
false;
47 if (hasErrors && !AllowASTWithErrors)
56 assert(hasErrors &&
"emitting module but current module doesn't exist");
63 if (AllowASTWithErrors)
67 assert(SemaPtr &&
"No Sema?");
73 ShouldCacheASTInMemory);
75 Buffer->IsComplete =
true;
Defines the clang::ASTContext interface.
Defines the clang::Preprocessor interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
ASTFileSignature WriteAST(Sema &SemaRef, StringRef OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false, bool ShouldCacheASTInMemory=false)
Write a precompiled header for the given semantic analysis.
bool hasErrorOccurred() const
DiagnosticConsumer * getClient()
bool hasUncompilableErrorOccurred() const
Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror.
In-memory cache for modules.
bool isCompilingModule() const
Are we compiling a module?
std::string CurrentModule
The name of the current module, of which the main source file is a part.
Describes a module or submodule.
ASTMutationListener * GetASTMutationListener() override
If the consumer is interested in entities getting modified after their initial creation,...
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
void HandleTranslationUnit(ASTContext &Ctx) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
PCHGenerator(const Preprocessor &PP, InMemoryModuleCache &ModuleCache, StringRef OutputFile, StringRef isysroot, std::shared_ptr< PCHBuffer > Buffer, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, bool AllowASTWithErrors=false, bool IncludeTimestamps=true, bool ShouldCacheASTInMemory=false)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with this preprocessor.
HeaderSearch & getHeaderSearchInfo() const
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
Encodes a location in the source.