[PATCH] D91366: Serialization: Hoist the check for in-flight diagnostics in ASTReader::getInputFile, NFC
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 13 10:26:51 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd87fd096ac3e: Serialization: Hoist the check for in-flight diagnostics in ASTReader… (authored by dexonsmith).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91366/new/
https://reviews.llvm.org/D91366
Files:
clang/include/clang/Serialization/ASTReader.h
clang/lib/Serialization/ASTReader.cpp
Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -1246,12 +1246,6 @@
Diag(DiagID) << Arg1 << Arg2 << Arg3;
}
-void ASTReader::Error(unsigned DiagID, StringRef Arg1, StringRef Arg2,
- unsigned Select) const {
- if (!Diags.isDiagnosticInFlight())
- Diag(DiagID) << Arg1 << Arg2 << Select;
-}
-
void ASTReader::Error(llvm::Error &&Err) const {
Error(toString(std::move(Err)));
}
@@ -2395,7 +2389,7 @@
auto FileChange = HasInputFileChanged();
// For an overridden file, there is nothing to validate.
if (!Overridden && FileChange != ModificationType::None) {
- if (Complain) {
+ if (Complain && !Diags.isDiagnosticInFlight()) {
// Build a list of the PCH imports that got us here (in reverse).
SmallVector<ModuleFile *, 4> ImportStack(1, &F);
while (!ImportStack.back()->ImportedBy.empty())
@@ -2406,17 +2400,17 @@
unsigned DiagnosticKind =
moduleKindForDiagnostic(ImportStack.back()->Kind);
if (DiagnosticKind == 0)
- Error(diag::err_fe_pch_file_modified, Filename, TopLevelPCHName,
- (unsigned)FileChange);
+ Diag(diag::err_fe_pch_file_modified)
+ << Filename << TopLevelPCHName << FileChange;
else if (DiagnosticKind == 1)
- Error(diag::err_fe_module_file_modified, Filename, TopLevelPCHName,
- (unsigned)FileChange);
+ Diag(diag::err_fe_module_file_modified)
+ << Filename << TopLevelPCHName << FileChange;
else
- Error(diag::err_fe_ast_file_modified, Filename, TopLevelPCHName,
- (unsigned)FileChange);
+ Diag(diag::err_fe_ast_file_modified)
+ << Filename << TopLevelPCHName << FileChange;
// Print the import stack.
- if (ImportStack.size() > 1 && !Diags.isDiagnosticInFlight()) {
+ if (ImportStack.size() > 1) {
Diag(diag::note_pch_required_by)
<< Filename << ImportStack[0]->FileName;
for (unsigned I = 1; I < ImportStack.size(); ++I)
@@ -2424,8 +2418,7 @@
<< ImportStack[I-1]->FileName << ImportStack[I]->FileName;
}
- if (!Diags.isDiagnosticInFlight())
- Diag(diag::note_pch_rebuild_required) << TopLevelPCHName;
+ Diag(diag::note_pch_rebuild_required) << TopLevelPCHName;
}
IsOutOfDate = true;
Index: clang/include/clang/Serialization/ASTReader.h
===================================================================
--- clang/include/clang/Serialization/ASTReader.h
+++ clang/include/clang/Serialization/ASTReader.h
@@ -1450,8 +1450,6 @@
void Error(StringRef Msg) const;
void Error(unsigned DiagID, StringRef Arg1 = StringRef(),
StringRef Arg2 = StringRef(), StringRef Arg3 = StringRef()) const;
- void Error(unsigned DiagID, StringRef Arg1, StringRef Arg2,
- unsigned Select) const;
void Error(llvm::Error &&Err) const;
public:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91366.305209.patch
Type: text/x-patch
Size: 3051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201113/dfa2397c/attachment.bin>
More information about the cfe-commits
mailing list