clang/Modules: Delay err_module_file_conflict if a diagnostic is in flight
As part of an audit of whether all errors are being reported from the
ASTReader, delay err_module_file_conflict if a diagnostic is already in
flight when it is hit. This required plumbing an extra argument through
the delayed diagnostic mechanics in DiagnosticsEngine.
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index b8bdfef..cc1f012 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1239,12 +1239,12 @@
}
}
-void ASTReader::Error(unsigned DiagID,
- StringRef Arg1, StringRef Arg2) const {
+void ASTReader::Error(unsigned DiagID, StringRef Arg1, StringRef Arg2,
+ StringRef Arg3) const {
if (Diags.isDiagnosticInFlight())
- Diags.SetDelayedDiagnostic(DiagID, Arg1, Arg2);
+ Diags.SetDelayedDiagnostic(DiagID, Arg1, Arg2, Arg3);
else
- Diag(DiagID) << Arg1 << Arg2;
+ Diag(DiagID) << Arg1 << Arg2 << Arg3;
}
void ASTReader::Error(unsigned DiagID, StringRef Arg1, StringRef Arg2,
@@ -5472,12 +5472,9 @@
// Don't emit module relocation error if we have -fno-validate-pch
if (!PP.getPreprocessorOpts().DisablePCHValidation &&
CurFile != F.File) {
- if (!Diags.isDiagnosticInFlight()) {
- Diag(diag::err_module_file_conflict)
- << CurrentModule->getTopLevelModuleName()
- << CurFile->getName()
- << F.File->getName();
- }
+ Error(diag::err_module_file_conflict,
+ CurrentModule->getTopLevelModuleName(), CurFile->getName(),
+ F.File->getName());
return Failure;
}
}