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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 17:58:36 PDT 2023


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

So this logic seems wrong. You are on one hand asserting `ASTHasCompilerErrors == trueHasErrors` and yet checking if they are not equal.


Is `getDiagnostics().hasUncompilableErrorOccurred()` in `ASTUnit::serialize` not the same as `SemaRef.PP.getDiagnostics().hasUncompilableErrorOccurred()`? 


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


More information about the cfe-commits mailing list