Index: clang/include/clang/Basic/Diagnostic.h =================================================================== --- clang/include/clang/Basic/Diagnostic.h +++ clang/include/clang/Basic/Diagnostic.h @@ -473,6 +473,9 @@ /// Second string argument for the delayed diagnostic. std::string DelayedDiagArg2; + /// Second string argument for the delayed diagnostic. + std::string DelayedDiagArg3; + /// Optional flag value. /// /// Some flags accept values, for instance: -Wframe-larger-than= and @@ -875,7 +878,7 @@ /// 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(); } Index: clang/include/clang/Serialization/ASTReader.h =================================================================== --- clang/include/clang/Serialization/ASTReader.h +++ clang/include/clang/Serialization/ASTReader.h @@ -1440,7 +1440,7 @@ /// 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; Index: clang/lib/Basic/Diagnostic.cpp =================================================================== --- clang/lib/Basic/Diagnostic.cpp +++ clang/lib/Basic/Diagnostic.cpp @@ -145,19 +145,20 @@ } 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) { Index: clang/lib/Serialization/ASTReader.cpp =================================================================== --- clang/lib/Serialization/ASTReader.cpp +++ 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, @@ -5487,12 +5487,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; } }