[clang] Fixes and closes #53952. Setting the ASTHasCompilerErrors member variable correctly based on the PP diagnostics. (PR #68127)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 05:33:47 PDT 2023


================
@@ -4628,6 +4628,12 @@ ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef, StringRef OutputFile,
   WritingAST = true;
 
   ASTHasCompilerErrors = hasErrors;
+  bool trueHasErrors = SemaRef.PP.getDiagnostics().hasUncompilableErrorOccurred();
----------------
AaronBallman wrote:

I would rather fix this by disallowing the user from passing `hasErrors` as an argument at all. The only callers of this API are all passing the same thing: `PP.getDiagnostics().hasUncompilableErrorOccured()`, so let's remove the parameter and use this directly. This makes the interface more simple and it fixes the crash; WDYT?

https://github.com/llvm/llvm-project/pull/68127


More information about the cfe-commits mailing list