[clang] [clang][serialization] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 11 10:39:44 PST 2024
================
@@ -4858,14 +4860,21 @@ time_t ASTWriter::getTimestampForOutput(const FileEntry *E) const {
return IncludeTimestamps ? E->getModificationTime() : 0;
}
-ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef, StringRef OutputFile,
- Module *WritingModule, StringRef isysroot,
- bool ShouldCacheASTInMemory) {
+ASTFileSignature
+ASTWriter::WriteAST(llvm::PointerUnion<Sema *, Preprocessor *> Subject,
+ StringRef OutputFile, Module *WritingModule,
+ StringRef isysroot, bool ShouldCacheASTInMemory) {
llvm::TimeTraceScope scope("WriteAST", OutputFile);
WritingAST = true;
- ASTHasCompilerErrors =
- SemaRef.PP.getDiagnostics().hasUncompilableErrorOccurred();
+ Sema *SemaPtr = Subject.dyn_cast<Sema *>();
+ Preprocessor &PPRef = [&]() -> Preprocessor & {
----------------
jansvoboda11 wrote:
Probably not, let's use ternary.
https://github.com/llvm/llvm-project/pull/115237
More information about the cfe-commits
mailing list