[PATCH] D91367: Serialization: Merge three diagnostics to simplify ASTReader::getInputFile, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 09:06:21 PST 2020


dexonsmith updated this revision to Diff 305184.
dexonsmith added a comment.

Rename to use `ast_` to match https://reviews.llvm.org/D91436.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91367/new/

https://reviews.llvm.org/D91367

Files:
  clang/include/clang/Basic/DiagnosticSerializationKinds.td
  clang/lib/Serialization/ASTReader.cpp


Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -2397,17 +2397,9 @@
 
       // The top-level PCH is stale.
       StringRef TopLevelPCHName(ImportStack.back()->FileName);
-      unsigned DiagnosticKind =
-          moduleKindForDiagnostic(ImportStack.back()->Kind);
-      if (DiagnosticKind == 0)
-        Diag(diag::err_fe_pch_file_modified)
-            << Filename << TopLevelPCHName << FileChange;
-      else if (DiagnosticKind == 1)
-        Diag(diag::err_fe_module_file_modified)
-            << Filename << TopLevelPCHName << FileChange;
-      else
-        Diag(diag::err_fe_ast_file_modified)
-            << Filename << TopLevelPCHName << FileChange;
+      Diag(diag::err_fe_ast_file_modified)
+          << Filename << moduleKindForDiagnostic(ImportStack.back()->Kind)
+          << TopLevelPCHName << FileChange;
 
       // Print the import stack.
       if (ImportStack.size() > 1) {
Index: clang/include/clang/Basic/DiagnosticSerializationKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSerializationKinds.td
+++ clang/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -17,17 +17,10 @@
     "malformed or corrupted AST file: '%0'">, DefaultFatal;
 def err_fe_pch_malformed_block : Error<
     "malformed block record in PCH file: '%0'">, DefaultFatal;
-def err_fe_pch_file_modified : Error<
-    "file '%0' has been modified since the precompiled header '%1' was built"
-    ": %select{size|mtime|content}2 changed">,
-    DefaultFatal;
-def err_fe_module_file_modified : Error<
-    "file '%0' has been modified since the module file '%1' was built"
-    ": %select{size|mtime|content}2 changed">,
-    DefaultFatal;
 def err_fe_ast_file_modified : Error<
-    "file '%0' has been modified since the AST file '%1' was built"
-    ": %select{size|mtime|content}2 changed">,
+    "file '%0' has been modified since the "
+    "%select{precompiled header|module file|AST file}1 '%2' was built"
+    ": %select{size|mtime|content}3 changed">,
     DefaultFatal;
 def err_fe_pch_file_overridden : Error<
     "file '%0' from the precompiled header has been overridden">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91367.305184.patch
Type: text/x-patch
Size: 2314 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201113/203b58e2/attachment.bin>


More information about the cfe-commits mailing list