19 #include "llvm/Bitstream/BitstreamWriter.h" 21 using namespace clang;
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)
55 assert(hasErrors &&
"emitting module but current module doesn't exist");
61 assert(SemaPtr &&
"No Sema?");
63 Writer.
WriteAST(*SemaPtr, OutputFile, Module, isysroot,
67 ShouldCacheASTInMemory);
69 Buffer->IsComplete =
true;
Defines the clang::ASTContext interface.
bool hasErrorOccurred() const
bool isCompilingModule() const
Are we compiling a module interface (.cppm or module map)?
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
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)
const LangOptions & getLangOpts() const
Describes a module or submodule.
HeaderSearch & getHeaderSearchInfo() const
std::string CurrentModule
The name of the current module, of which the main source file is a part.
ASTFileSignature WriteAST(Sema &SemaRef, const std::string &OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false, bool ShouldCacheASTInMemory=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...
bool hasUncompilableErrorOccurred() const
Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror...
Defines the clang::Preprocessor interface.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
In-memory cache for modules.
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.
Dataflow Directional Tag Classes.
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with this preprocessor.
DiagnosticsEngine & getDiagnostics() const
Engages in a tight little dance with the lexer to efficiently preprocess tokens.