diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 9e494aa371cda6..94ae011a0b20bf 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -473,6 +473,9 @@ class DiagnosticsEngine : public RefCountedBase { /// Second string argument for the delayed diagnostic. std::string DelayedDiagArg2; + /// Third string argument for the delayed diagnostic. + std::string DelayedDiagArg3; + /// Optional flag value. /// /// Some flags accept values, for instance: -Wframe-larger-than= and @@ -874,8 +877,12 @@ class DiagnosticsEngine : public RefCountedBase { /// \param Arg2 A string argument that will be provided to the /// diagnostic. A copy of this string will be stored in the /// DiagnosticsEngine object itself. + /// + /// \param Arg3 A string argument that will be provided to the + /// diagnostic. A copy of this string will be stored in the + /// DiagnosticsEngine object itself. void SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1 = "", - StringRef Arg2 = ""); + StringRef Arg2 = "", StringRef Arg3 = ""); /// Clear out the current diagnostic. void Clear() { CurDiagID = std::numeric_limits::max(); } diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 7495c2b17aa27b..2b2010f583d5f0 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -1440,7 +1440,7 @@ class ASTReader /// do with non-routine failures (e.g., corrupted AST file). void Error(StringRef Msg) const; void Error(unsigned DiagID, StringRef Arg1 = StringRef(), - StringRef Arg2 = StringRef()) const; + StringRef Arg2 = StringRef(), StringRef Arg3 = StringRef()) const; void Error(unsigned DiagID, StringRef Arg1, StringRef Arg2, unsigned Select) const; void Error(llvm::Error &&Err) const; diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index c82f74413ec147..f686b6953e303b 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -145,19 +145,20 @@ void DiagnosticsEngine::Reset() { } void DiagnosticsEngine::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1, - StringRef Arg2) { + StringRef Arg2, StringRef Arg3) { if (DelayedDiagID) return; DelayedDiagID = DiagID; DelayedDiagArg1 = Arg1.str(); DelayedDiagArg2 = Arg2.str(); + DelayedDiagArg3 = Arg3.str(); } void DiagnosticsEngine::ReportDelayed() { unsigned ID = DelayedDiagID; DelayedDiagID = 0; - Report(ID) << DelayedDiagArg1 << DelayedDiagArg2; + Report(ID) << DelayedDiagArg1 << DelayedDiagArg2 << DelayedDiagArg3; } void DiagnosticsEngine::DiagStateMap::appendFirst(DiagState *State) { diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index b8bdfef791b966..cc1f012108853e 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1239,12 +1239,12 @@ void ASTReader::Error(StringRef Msg) const { } } -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 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { // 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; } }