diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 4ed49a0ee4..d989332d0c 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -126,4 +126,7 @@ def note_using_macro_def_from_pch : Note< def warn_macro_name_used_in_pch : Warning< "definition of macro %0 conflicts with an identifier used in the " "precompiled header">; +def warn_pch_compiler_options_mismatch : Warning< + "compiler options used when building the precompiled header differ from " + "the ptions used when using the precompiled header">; } diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index e7404f899b..8324f8de0b 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -400,8 +400,8 @@ bool PCHReader::CheckPredefinesBuffer(const char *PCHPredef, for (unsigned I = 0, N = MissingPredefines.size(); I != N; ++I) { const std::string &Missing = MissingPredefines[I]; if (!startsWith(Missing, "#define ") != 0) { - fprintf(stderr, "FIXME: command line is missing a non-macro entry in the predefines buffer that was used to build the PCH file\n%s\n", - Missing.c_str()); + Diag(diag::warn_pch_compiler_options_mismatch); + Diag(diag::note_ignoring_pch) << FileName; return true; } @@ -492,8 +492,8 @@ bool PCHReader::CheckPredefinesBuffer(const char *PCHPredef, for (unsigned I = 0, N = ExtraPredefines.size(); I != N; ++I) { const std::string &Extra = ExtraPredefines[I]; if (!startsWith(Extra, "#define ") != 0) { - fprintf(stderr, "FIXME: command line has extra predefines not used to build the PCH file.%s\n", - Extra.c_str()); + Diag(diag::warn_pch_compiler_options_mismatch); + Diag(diag::note_ignoring_pch) << FileName; return true; }