[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
Thu Nov 12 10:15:30 PST 2020
dexonsmith created this revision.
dexonsmith added a reviewer: jansvoboda11.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.
Clean up the logic for `err_fe_{pch,module,ast}_file_modified` to use a
`select` like other ASTReader diagnostics. There should be no
functionality change here, just a cleanup.
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_pch_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
@@ -18,16 +18,9 @@
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.304890.patch
Type: text/x-patch
Size: 2252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201112/06d2813f/attachment.bin>
More information about the cfe-commits
mailing list