diff --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td b/clang/include/clang/Basic/DiagnosticSerializationKinds.td index 51d0abbbec252..9854972cbfe7e 100644 --- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td +++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td @@ -29,20 +29,20 @@ def note_pch_rebuild_required : Note<"please rebuild precompiled header '%0'">; def note_module_cache_path : Note< "after modifying system headers, please delete the module cache at '%0'">; -def err_pch_targetopt_mismatch : Error< - "PCH file was compiled for the %0 '%1' but the current translation " - "unit is being compiled for target '%2'">; -def err_pch_targetopt_feature_mismatch : Error< - "%select{AST file was|current translation unit is}0 compiled with the target " - "feature '%1' but the %select{current translation unit is|AST file was}0 " +def err_ast_file_targetopt_mismatch : Error< + "AST file '%0' was compiled for the %1 '%2' but the current translation " + "unit is being compiled for target '%3'">; +def err_ast_file_targetopt_feature_mismatch : Error< + "%select{AST file '%1' was|current translation unit is}0 compiled with the target " + "feature '%2' but the %select{current translation unit is|AST file '%1' was}0 " "not">; -def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in " - "PCH file but is currently %select{disabled|enabled}2">; -def err_pch_langopt_value_mismatch : Error< - "%0 differs in PCH file vs. current file">; -def err_pch_diagopt_mismatch : Error<"%0 is currently enabled, but was not in " - "the PCH file">; -def err_pch_modulecache_mismatch : Error<"PCH was compiled with module cache " +def err_ast_file_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in " + "AST file '%3' but is currently %select{disabled|enabled}2">; +def err_ast_file_langopt_value_mismatch : Error< + "%0 differs in AST file '%1' vs. current file">; +def err_ast_file_diagopt_mismatch : Error<"%0 is currently enabled, but was not in " + "the AST file '%1'">; +def err_ast_file_modulecache_mismatch : Error<"AST file '%2' was compiled with module cache " "path '%0', but the path is currently '%1'">; def warn_pch_vfsoverlay_mismatch : Warning< "PCH was compiled with different VFS overlay files than are currently in use">, @@ -99,19 +99,19 @@ def err_module_different_modmap : Error< "module '%0' %select{uses|does not use}1 additional module map '%2'" "%select{| not}1 used when the module was built">; -def err_pch_macro_def_undef : Error< - "macro '%0' was %select{defined|undef'd}1 in the precompiled header but " +def err_ast_file_macro_def_undef : Error< + "macro '%0' was %select{defined|undef'd}1 in the AST file '%2' but " "%select{undef'd|defined}1 on the command line">; -def err_pch_macro_def_conflict : Error< - "definition of macro '%0' differs between the precompiled header ('%1') " +def err_ast_file_macro_def_conflict : Error< + "definition of macro '%0' differs between the AST file '%3' ('%1') " "and the command line ('%2')">; -def err_pch_undef : Error< - "%select{command line contains|precompiled header was built with}0 " - "'-undef' but %select{precompiled header was not built with it|" +def err_ast_file_undef : Error< + "%select{command line contains|AST file '%1' was built with}0 " + "'-undef' but %select{AST file '%1' was not built with it|" "it is not present on the command line}0">; -def err_pch_pp_detailed_record : Error< - "%select{command line contains|precompiled header was built with}0 " - "'-detailed-preprocessing-record' but %select{precompiled header was not " +def err_ast_file_pp_detailed_record : Error< + "%select{command line contains|AST file '%1' was built with}0 " + "'-detailed-preprocessing-record' but %select{AST file '%1' was not " "built with it|it is not present on the command line}0">; def err_module_odr_violation_missing_decl : Error< diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 76e51ac7ab979..724d71fb6a304 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -130,6 +130,7 @@ class ASTReaderListener { /// /// \returns true to indicate the options are invalid or false otherwise. virtual bool ReadLanguageOptions(const LangOptions &LangOpts, + StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) { return false; @@ -139,7 +140,7 @@ class ASTReaderListener { /// /// \returns true to indicate the target options are invalid, or false /// otherwise. - virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, + virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) { return false; } @@ -150,6 +151,7 @@ class ASTReaderListener { /// otherwise. virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr DiagOpts, + StringRef ModuleFilename, bool Complain) { return false; } @@ -172,6 +174,7 @@ class ASTReaderListener { /// \returns true to indicate the header search options are invalid, or false /// otherwise. virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) { return false; @@ -200,6 +203,7 @@ class ASTReaderListener { /// \returns true to indicate the preprocessor options are invalid, or false /// otherwise. virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) { return false; @@ -262,19 +266,22 @@ class ChainedASTReaderListener : public ASTReaderListener { bool ReadFullVersionInformation(StringRef FullVersion) override; void ReadModuleName(StringRef ModuleName) override; void ReadModuleMapFile(StringRef ModuleMapPath) override; - bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, + bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override; - bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, + bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override; bool ReadDiagnosticOptions(IntrusiveRefCntPtr DiagOpts, + StringRef ModuleFilename, bool Complain) override; bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override; bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override; bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override; @@ -299,16 +306,19 @@ class PCHValidator : public ASTReaderListener { PCHValidator(Preprocessor &PP, ASTReader &Reader) : PP(PP), Reader(Reader) {} - bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, + bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override; - bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, + bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override; bool ReadDiagnosticOptions(IntrusiveRefCntPtr DiagOpts, + StringRef ModuleFilename, bool Complain) override; bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override; bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override; void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override; @@ -325,6 +335,7 @@ class SimpleASTReaderListener : public ASTReaderListener { SimpleASTReaderListener(Preprocessor &PP) : PP(PP) {} bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override; }; @@ -1362,7 +1373,7 @@ class ASTReader const ModuleFile *ImportedBy, unsigned ClientLoadCapabilities); static ASTReadResult ReadOptionsBlock( - llvm::BitstreamCursor &Stream, unsigned ClientLoadCapabilities, + llvm::BitstreamCursor &Stream, StringRef Filename, unsigned ClientLoadCapabilities, bool AllowCompatibleConfigurationMismatch, ASTReaderListener &Listener, std::string &SuggestedPredefines); @@ -1375,6 +1386,7 @@ class ASTReader static ASTReadResult readUnhashedControlBlockImpl(ModuleFile *F, llvm::StringRef StreamData, + StringRef Filename, unsigned ClientLoadCapabilities, bool AllowCompatibleConfigurationMismatch, ASTReaderListener *Listener, @@ -1391,21 +1403,21 @@ class ASTReader unsigned ClientLoadCapabilities); llvm::Error ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities); - static bool ParseLanguageOptions(const RecordData &Record, bool Complain, + static bool ParseLanguageOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener, bool AllowCompatibleDifferences); - static bool ParseTargetOptions(const RecordData &Record, bool Complain, + static bool ParseTargetOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener, bool AllowCompatibleDifferences); - static bool ParseDiagnosticOptions(const RecordData &Record, bool Complain, + static bool ParseDiagnosticOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener); static bool ParseFileSystemOptions(const RecordData &Record, bool Complain, ASTReaderListener &Listener); - static bool ParseHeaderSearchOptions(const RecordData &Record, bool Complain, + static bool ParseHeaderSearchOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener); static bool ParseHeaderSearchPaths(const RecordData &Record, bool Complain, ASTReaderListener &Listener); - static bool ParsePreprocessorOptions(const RecordData &Record, bool Complain, + static bool ParsePreprocessorOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener, std::string &SuggestedPredefines); diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 67d4c07d1ce39..aec1402d6cb95 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -536,7 +536,7 @@ class ASTInfoCollector : public ASTReaderListener { LangOpt(LangOpt), TargetOpts(TargetOpts), Target(Target), Counter(Counter) {} - bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, + bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override { if (InitializedLanguage) return false; @@ -559,6 +559,7 @@ class ASTInfoCollector : public ASTReaderListener { } bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override { // llvm::SaveAndRestore doesn't support bit field. @@ -597,13 +598,14 @@ class ASTInfoCollector : public ASTReaderListener { } bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override { this->PPOpts = PPOpts; return false; } - bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, + bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override { // If we've already initialized the target, don't do it again. if (Target) diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index e70210d55fe28..f9887fe634ec6 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -622,7 +622,7 @@ namespace { Out.indent(2) << "Module map file: " << ModuleMapPath << "\n"; } - bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, + bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override { Out.indent(2) << "Language options:\n"; #define LANGOPT(Name, Bits, Default, Description) \ @@ -645,7 +645,7 @@ namespace { return false; } - bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, + bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override { Out.indent(2) << "Target options:\n"; Out.indent(4) << " Triple: " << TargetOpts.Triple << "\n"; @@ -665,7 +665,7 @@ namespace { } bool ReadDiagnosticOptions(IntrusiveRefCntPtr DiagOpts, - bool Complain) override { + StringRef ModuleFilename, bool Complain) override { Out.indent(2) << "Diagnostic options:\n"; #define DIAGOPT(Name, Bits, Default) DUMP_BOOLEAN(DiagOpts->Name, #Name); #define ENUM_DIAGOPT(Name, Type, Bits, Default) \ @@ -684,6 +684,7 @@ namespace { } bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override { Out.indent(2) << "Header search options:\n"; @@ -717,6 +718,7 @@ namespace { } bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override { Out.indent(2) << "Preprocessor options:\n"; diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 86fa96a91932f..f082ecde00ca9 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -173,27 +173,28 @@ void ChainedASTReaderListener::ReadModuleMapFile(StringRef ModuleMapPath) { bool ChainedASTReaderListener::ReadLanguageOptions(const LangOptions &LangOpts, + StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) { - return First->ReadLanguageOptions(LangOpts, Complain, + return First->ReadLanguageOptions(LangOpts, ModuleFilename, Complain, AllowCompatibleDifferences) || - Second->ReadLanguageOptions(LangOpts, Complain, + Second->ReadLanguageOptions(LangOpts, ModuleFilename, Complain, AllowCompatibleDifferences); } bool ChainedASTReaderListener::ReadTargetOptions( - const TargetOptions &TargetOpts, bool Complain, + const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) { - return First->ReadTargetOptions(TargetOpts, Complain, + return First->ReadTargetOptions(TargetOpts, ModuleFilename, Complain, AllowCompatibleDifferences) || - Second->ReadTargetOptions(TargetOpts, Complain, + Second->ReadTargetOptions(TargetOpts, ModuleFilename, Complain, AllowCompatibleDifferences); } bool ChainedASTReaderListener::ReadDiagnosticOptions( - IntrusiveRefCntPtr DiagOpts, bool Complain) { - return First->ReadDiagnosticOptions(DiagOpts, Complain) || - Second->ReadDiagnosticOptions(DiagOpts, Complain); + IntrusiveRefCntPtr DiagOpts, StringRef ModuleFilename, bool Complain) { + return First->ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain) || + Second->ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain); } bool @@ -204,20 +205,20 @@ ChainedASTReaderListener::ReadFileSystemOptions(const FileSystemOptions &FSOpts, } bool ChainedASTReaderListener::ReadHeaderSearchOptions( - const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, + const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) { - return First->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath, + return First->ReadHeaderSearchOptions(HSOpts, ModuleFilename, SpecificModuleCachePath, Complain) || - Second->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath, + Second->ReadHeaderSearchOptions(HSOpts, ModuleFilename, SpecificModuleCachePath, Complain); } bool ChainedASTReaderListener::ReadPreprocessorOptions( - const PreprocessorOptions &PPOpts, bool ReadMacros, bool Complain, + const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) { - return First->ReadPreprocessorOptions(PPOpts, ReadMacros, Complain, + return First->ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros, Complain, SuggestedPredefines) || - Second->ReadPreprocessorOptions(PPOpts, ReadMacros, Complain, + Second->ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros, Complain, SuggestedPredefines); } @@ -281,17 +282,17 @@ ASTReaderListener::~ASTReaderListener() = default; /// \returns true if the languagae options mis-match, false otherwise. static bool checkLanguageOptions(const LangOptions &LangOpts, const LangOptions &ExistingLangOpts, - DiagnosticsEngine *Diags, + StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences = true) { #define LANGOPT(Name, Bits, Default, Description) \ if (ExistingLangOpts.Name != LangOpts.Name) { \ if (Diags) { \ if (Bits == 1) \ - Diags->Report(diag::err_pch_langopt_mismatch) \ - << Description << LangOpts.Name << ExistingLangOpts.Name; \ + Diags->Report(diag::err_ast_file_langopt_mismatch) \ + << Description << LangOpts.Name << ExistingLangOpts.Name << ModuleFilename; \ else \ - Diags->Report(diag::err_pch_langopt_value_mismatch) \ - << Description; \ + Diags->Report(diag::err_ast_file_langopt_value_mismatch) \ + << Description << ModuleFilename; \ } \ return true; \ } @@ -299,16 +300,16 @@ static bool checkLanguageOptions(const LangOptions &LangOpts, #define VALUE_LANGOPT(Name, Bits, Default, Description) \ if (ExistingLangOpts.Name != LangOpts.Name) { \ if (Diags) \ - Diags->Report(diag::err_pch_langopt_value_mismatch) \ - << Description; \ + Diags->Report(diag::err_ast_file_langopt_value_mismatch) \ + << Description << ModuleFilename; \ return true; \ } #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \ if (Diags) \ - Diags->Report(diag::err_pch_langopt_value_mismatch) \ - << Description; \ + Diags->Report(diag::err_ast_file_langopt_value_mismatch) \ + << Description << ModuleFilename; \ return true; \ } @@ -331,22 +332,22 @@ static bool checkLanguageOptions(const LangOptions &LangOpts, if (ExistingLangOpts.ModuleFeatures != LangOpts.ModuleFeatures) { if (Diags) - Diags->Report(diag::err_pch_langopt_value_mismatch) << "module features"; + Diags->Report(diag::err_ast_file_langopt_value_mismatch) << "module features" << ModuleFilename; return true; } if (ExistingLangOpts.ObjCRuntime != LangOpts.ObjCRuntime) { if (Diags) - Diags->Report(diag::err_pch_langopt_value_mismatch) - << "target Objective-C runtime"; + Diags->Report(diag::err_ast_file_langopt_value_mismatch) + << "target Objective-C runtime" << ModuleFilename; return true; } if (ExistingLangOpts.CommentOpts.BlockCommandNames != LangOpts.CommentOpts.BlockCommandNames) { if (Diags) - Diags->Report(diag::err_pch_langopt_value_mismatch) - << "block command names"; + Diags->Report(diag::err_ast_file_langopt_value_mismatch) + << "block command names" << ModuleFilename; return true; } @@ -368,8 +369,8 @@ static bool checkLanguageOptions(const LangOptions &LangOpts, bool InExistingModule = ExistingSanitizers.has(SanitizerKind::ID); \ bool InImportedModule = ImportedSanitizers.has(SanitizerKind::ID); \ if (InExistingModule != InImportedModule) \ - Diags->Report(diag::err_pch_targetopt_feature_mismatch) \ - << InExistingModule << (Flag + NAME); \ + Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) \ + << InExistingModule << ModuleFilename << (Flag + NAME); \ } #include "clang/Basic/Sanitizers.def" } @@ -388,13 +389,13 @@ static bool checkLanguageOptions(const LangOptions &LangOpts, /// \returns true if the target options mis-match, false otherwise. static bool checkTargetOptions(const TargetOptions &TargetOpts, const TargetOptions &ExistingTargetOpts, - DiagnosticsEngine *Diags, + StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences = true) { #define CHECK_TARGET_OPT(Field, Name) \ if (TargetOpts.Field != ExistingTargetOpts.Field) { \ if (Diags) \ - Diags->Report(diag::err_pch_targetopt_mismatch) \ - << Name << TargetOpts.Field << ExistingTargetOpts.Field; \ + Diags->Report(diag::err_ast_file_targetopt_mismatch) \ + << ModuleFilename << Name << TargetOpts.Field << ExistingTargetOpts.Field; \ return true; \ } @@ -438,11 +439,11 @@ static bool checkTargetOptions(const TargetOptions &TargetOpts, if (Diags) { for (StringRef Feature : UnmatchedReadFeatures) - Diags->Report(diag::err_pch_targetopt_feature_mismatch) - << /* is-existing-feature */ false << Feature; + Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) + << /* is-existing-feature */ false << ModuleFilename << Feature; for (StringRef Feature : UnmatchedExistingFeatures) - Diags->Report(diag::err_pch_targetopt_feature_mismatch) - << /* is-existing-feature */ true << Feature; + Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) + << /* is-existing-feature */ true << ModuleFilename << Feature; } return !UnmatchedReadFeatures.empty() || !UnmatchedExistingFeatures.empty(); @@ -450,19 +451,20 @@ static bool checkTargetOptions(const TargetOptions &TargetOpts, bool PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts, + StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) { const LangOptions &ExistingLangOpts = PP.getLangOpts(); - return checkLanguageOptions(LangOpts, ExistingLangOpts, + return checkLanguageOptions(LangOpts, ExistingLangOpts, ModuleFilename, Complain ? &Reader.Diags : nullptr, AllowCompatibleDifferences); } bool PCHValidator::ReadTargetOptions(const TargetOptions &TargetOpts, - bool Complain, + StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) { const TargetOptions &ExistingTargetOpts = PP.getTargetInfo().getTargetOpts(); - return checkTargetOptions(TargetOpts, ExistingTargetOpts, + return checkTargetOptions(TargetOpts, ExistingTargetOpts, ModuleFilename, Complain ? &Reader.Diags : nullptr, AllowCompatibleDifferences); } @@ -477,7 +479,7 @@ using DeclsMap = llvm::DenseMap>; static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, - bool Complain) { + StringRef ModuleFilename, bool Complain) { using Level = DiagnosticsEngine::Level; // Check current mappings for new -Werror mappings, and the stored mappings @@ -495,8 +497,8 @@ static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags, StoredDiags.getDiagnosticLevel(DiagID, SourceLocation()); if (StoredLevel < DiagnosticsEngine::Error) { if (Complain) - Diags.Report(diag::err_pch_diagopt_mismatch) << "-Werror=" + - Diags.getDiagnosticIDs()->getWarningOptionForDiag(DiagID).str(); + Diags.Report(diag::err_ast_file_diagopt_mismatch) << "-Werror=" + + Diags.getDiagnosticIDs()->getWarningOptionForDiag(DiagID).str() << ModuleFilename; return true; } } @@ -513,7 +515,7 @@ static bool isExtHandlingFromDiagsError(DiagnosticsEngine &Diags) { } static bool checkDiagnosticMappings(DiagnosticsEngine &StoredDiags, - DiagnosticsEngine &Diags, bool IsSystem, + DiagnosticsEngine &Diags, StringRef ModuleFilename, bool IsSystem, bool SystemHeaderWarningsInModule, bool Complain) { // Top-level options @@ -525,32 +527,32 @@ static bool checkDiagnosticMappings(DiagnosticsEngine &StoredDiags, if (StoredDiags.getSuppressSystemWarnings() && !SystemHeaderWarningsInModule) { if (Complain) - Diags.Report(diag::err_pch_diagopt_mismatch) << "-Wsystem-headers"; + Diags.Report(diag::err_ast_file_diagopt_mismatch) << "-Wsystem-headers" << ModuleFilename; return true; } } if (Diags.getWarningsAsErrors() && !StoredDiags.getWarningsAsErrors()) { if (Complain) - Diags.Report(diag::err_pch_diagopt_mismatch) << "-Werror"; + Diags.Report(diag::err_ast_file_diagopt_mismatch) << "-Werror" << ModuleFilename; return true; } if (Diags.getWarningsAsErrors() && Diags.getEnableAllWarnings() && !StoredDiags.getEnableAllWarnings()) { if (Complain) - Diags.Report(diag::err_pch_diagopt_mismatch) << "-Weverything -Werror"; + Diags.Report(diag::err_ast_file_diagopt_mismatch) << "-Weverything -Werror" << ModuleFilename; return true; } if (isExtHandlingFromDiagsError(Diags) && !isExtHandlingFromDiagsError(StoredDiags)) { if (Complain) - Diags.Report(diag::err_pch_diagopt_mismatch) << "-pedantic-errors"; + Diags.Report(diag::err_ast_file_diagopt_mismatch) << "-pedantic-errors" << ModuleFilename; return true; } - return checkDiagnosticGroupMappings(StoredDiags, Diags, Complain); + return checkDiagnosticGroupMappings(StoredDiags, Diags, ModuleFilename, Complain); } /// Return the top import module if it is implicit, nullptr otherwise. @@ -579,7 +581,7 @@ static Module *getTopImportImplicitModule(ModuleManager &ModuleMgr, } bool PCHValidator::ReadDiagnosticOptions( - IntrusiveRefCntPtr DiagOpts, bool Complain) { + IntrusiveRefCntPtr DiagOpts, StringRef ModuleFilename, bool Complain) { DiagnosticsEngine &ExistingDiags = PP.getDiagnostics(); IntrusiveRefCntPtr DiagIDs(ExistingDiags.getDiagnosticIDs()); IntrusiveRefCntPtr Diags( @@ -604,7 +606,7 @@ bool PCHValidator::ReadDiagnosticOptions( // FIXME: if the diagnostics are incompatible, save a DiagnosticOptions that // contains the union of their flags. - return checkDiagnosticMappings(*Diags, ExistingDiags, TopM->IsSystem, + return checkDiagnosticMappings(*Diags, ExistingDiags, ModuleFilename, TopM->IsSystem, SystemHeaderWarningsInModule, Complain); } @@ -664,7 +666,7 @@ enum OptionValidation { /// are no differences in the options between the two. static bool checkPreprocessorOptions( const PreprocessorOptions &PPOpts, - const PreprocessorOptions &ExistingPPOpts, bool ReadMacros, + const PreprocessorOptions &ExistingPPOpts, StringRef ModuleFilename, bool ReadMacros, DiagnosticsEngine *Diags, FileManager &FileMgr, std::string &SuggestedPredefines, const LangOptions &LangOpts, OptionValidation Validation = OptionValidateContradictions) { @@ -694,7 +696,7 @@ static bool checkPreprocessorOptions( // If strict matches are requested, don't tolerate any extra defines // on the command line that are missing in the AST file. if (Diags) { - Diags->Report(diag::err_pch_macro_def_undef) << MacroName << true; + Diags->Report(diag::err_ast_file_macro_def_undef) << MacroName << true << ModuleFilename; } return true; } @@ -720,8 +722,8 @@ static bool checkPreprocessorOptions( // conflict. if (Existing.second != Known->second.second) { if (Diags) { - Diags->Report(diag::err_pch_macro_def_undef) - << MacroName << Known->second.second; + Diags->Report(diag::err_ast_file_macro_def_undef) + << MacroName << Known->second.second << ModuleFilename; } return true; } @@ -735,8 +737,8 @@ static bool checkPreprocessorOptions( // The macro bodies differ; complain. if (Diags) { - Diags->Report(diag::err_pch_macro_def_conflict) - << MacroName << Known->second.first << Existing.first; + Diags->Report(diag::err_ast_file_macro_def_conflict) + << MacroName << Known->second.first << Existing.first << ModuleFilename; } return true; } @@ -749,7 +751,7 @@ static bool checkPreprocessorOptions( // the AST file that are missing on the command line. for (const auto &MacroName : ASTFileMacros.keys()) { if (Diags) { - Diags->Report(diag::err_pch_macro_def_undef) << MacroName << false; + Diags->Report(diag::err_ast_file_macro_def_undef) << MacroName << false << ModuleFilename; } return true; } @@ -760,7 +762,7 @@ static bool checkPreprocessorOptions( if (PPOpts.UsePredefines != ExistingPPOpts.UsePredefines && Validation != OptionValidateNone) { if (Diags) { - Diags->Report(diag::err_pch_undef) << ExistingPPOpts.UsePredefines; + Diags->Report(diag::err_ast_file_undef) << ExistingPPOpts.UsePredefines << ModuleFilename; } return true; } @@ -770,7 +772,7 @@ static bool checkPreprocessorOptions( PPOpts.DetailedRecord != ExistingPPOpts.DetailedRecord && Validation != OptionValidateNone) { if (Diags) { - Diags->Report(diag::err_pch_pp_detailed_record) << PPOpts.DetailedRecord; + Diags->Report(diag::err_ast_file_pp_detailed_record) << PPOpts.DetailedRecord << ModuleFilename; } return true; } @@ -814,19 +816,19 @@ static bool checkPreprocessorOptions( } bool PCHValidator::ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, - bool ReadMacros, bool Complain, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) { const PreprocessorOptions &ExistingPPOpts = PP.getPreprocessorOpts(); return checkPreprocessorOptions( - PPOpts, ExistingPPOpts, ReadMacros, Complain ? &Reader.Diags : nullptr, + PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros, Complain ? &Reader.Diags : nullptr, PP.getFileManager(), SuggestedPredefines, PP.getLangOpts()); } bool SimpleASTReaderListener::ReadPreprocessorOptions( - const PreprocessorOptions &PPOpts, bool ReadMacros, bool Complain, + const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) { - return checkPreprocessorOptions(PPOpts, PP.getPreprocessorOpts(), ReadMacros, + return checkPreprocessorOptions(PPOpts, PP.getPreprocessorOpts(), ModuleFilename, ReadMacros, nullptr, PP.getFileManager(), SuggestedPredefines, PP.getLangOpts(), OptionValidateNone); @@ -839,7 +841,7 @@ bool SimpleASTReaderListener::ReadPreprocessorOptions( static bool checkModuleCachePath(llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, - DiagnosticsEngine *Diags, + StringRef ModuleFilename, DiagnosticsEngine *Diags, const LangOptions &LangOpts, const PreprocessorOptions &PPOpts) { if (!LangOpts.Modules || PPOpts.AllowPCHWithDifferentModulesCachePath || @@ -850,18 +852,19 @@ static bool checkModuleCachePath(llvm::vfs::FileSystem &VFS, if (EqualOrErr && *EqualOrErr) return false; if (Diags) - Diags->Report(diag::err_pch_modulecache_mismatch) - << SpecificModuleCachePath << ExistingModuleCachePath; + Diags->Report(diag::err_ast_file_modulecache_mismatch) + << SpecificModuleCachePath << ExistingModuleCachePath << ModuleFilename; return true; } bool PCHValidator::ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) { return checkModuleCachePath(Reader.getFileManager().getVirtualFileSystem(), SpecificModuleCachePath, PP.getHeaderSearchInfo().getModuleCachePath(), - Complain ? &Reader.Diags : nullptr, + ModuleFilename, Complain ? &Reader.Diags : nullptr, PP.getLangOpts(), PP.getPreprocessorOpts()); } @@ -2759,7 +2762,7 @@ static bool isDiagnosedResult(ASTReader::ASTReadResult ARR, unsigned Caps) { } ASTReader::ASTReadResult ASTReader::ReadOptionsBlock( - BitstreamCursor &Stream, unsigned ClientLoadCapabilities, + BitstreamCursor &Stream, StringRef Filename, unsigned ClientLoadCapabilities, bool AllowCompatibleConfigurationMismatch, ASTReaderListener &Listener, std::string &SuggestedPredefines) { if (llvm::Error Err = Stream.EnterSubBlock(OPTIONS_BLOCK_ID)) { @@ -2804,7 +2807,7 @@ ASTReader::ASTReadResult ASTReader::ReadOptionsBlock( switch ((OptionsRecordTypes)MaybeRecordType.get()) { case LANGUAGE_OPTIONS: { bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0; - if (ParseLanguageOptions(Record, Complain, Listener, + if (ParseLanguageOptions(Record, Filename, Complain, Listener, AllowCompatibleConfigurationMismatch)) Result = ConfigurationMismatch; break; @@ -2812,7 +2815,7 @@ ASTReader::ASTReadResult ASTReader::ReadOptionsBlock( case TARGET_OPTIONS: { bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0; - if (ParseTargetOptions(Record, Complain, Listener, + if (ParseTargetOptions(Record, Filename, Complain, Listener, AllowCompatibleConfigurationMismatch)) Result = ConfigurationMismatch; break; @@ -2829,7 +2832,7 @@ ASTReader::ASTReadResult ASTReader::ReadOptionsBlock( case HEADER_SEARCH_OPTIONS: { bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0; if (!AllowCompatibleConfigurationMismatch && - ParseHeaderSearchOptions(Record, Complain, Listener)) + ParseHeaderSearchOptions(Record, Filename, Complain, Listener)) Result = ConfigurationMismatch; break; } @@ -2837,7 +2840,7 @@ ASTReader::ASTReadResult ASTReader::ReadOptionsBlock( case PREPROCESSOR_OPTIONS: bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0; if (!AllowCompatibleConfigurationMismatch && - ParsePreprocessorOptions(Record, Complain, Listener, + ParsePreprocessorOptions(Record, Filename, Complain, Listener, SuggestedPredefines)) Result = ConfigurationMismatch; break; @@ -2974,7 +2977,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, F.Kind == MK_ExplicitModule || F.Kind == MK_PrebuiltModule; ASTReadResult Result = - ReadOptionsBlock(Stream, ClientLoadCapabilities, + ReadOptionsBlock(Stream, F.FileName, ClientLoadCapabilities, AllowCompatibleConfigurationMismatch, *Listener, SuggestedPredefines); if (Result == Failure) { @@ -4863,7 +4866,7 @@ ASTReader::readUnhashedControlBlock(ModuleFile &F, bool WasImportedBy, bool DisableValidation = shouldDisableValidationForFile(F); ASTReadResult Result = readUnhashedControlBlockImpl( - &F, F.Data, ClientLoadCapabilities, AllowCompatibleConfigurationMismatch, + &F, F.Data, F.FileName, ClientLoadCapabilities, AllowCompatibleConfigurationMismatch, Listener.get(), WasImportedBy ? false : HSOpts.ModulesValidateDiagnosticOptions); @@ -4907,7 +4910,7 @@ ASTReader::readUnhashedControlBlock(ModuleFile &F, bool WasImportedBy, } ASTReader::ASTReadResult ASTReader::readUnhashedControlBlockImpl( - ModuleFile *F, llvm::StringRef StreamData, unsigned ClientLoadCapabilities, + ModuleFile *F, llvm::StringRef StreamData, StringRef Filename, unsigned ClientLoadCapabilities, bool AllowCompatibleConfigurationMismatch, ASTReaderListener *Listener, bool ValidateDiagnosticOptions) { // Initialize a stream. @@ -4977,7 +4980,7 @@ ASTReader::ASTReadResult ASTReader::readUnhashedControlBlockImpl( bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0; if (Listener && ValidateDiagnosticOptions && !AllowCompatibleConfigurationMismatch && - ParseDiagnosticOptions(Record, Complain, *Listener)) + ParseDiagnosticOptions(Record, Filename, Complain, *Listener)) Result = OutOfDate; // Don't return early. Read the signature. break; } @@ -5364,31 +5367,33 @@ namespace { ExistingModuleCachePath(ExistingModuleCachePath), FileMgr(FileMgr), StrictOptionMatches(StrictOptionMatches) {} - bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, + bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override { - return checkLanguageOptions(ExistingLangOpts, LangOpts, nullptr, + return checkLanguageOptions(ExistingLangOpts, LangOpts, ModuleFilename, nullptr, AllowCompatibleDifferences); } - bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, + bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override { - return checkTargetOptions(ExistingTargetOpts, TargetOpts, nullptr, + return checkTargetOptions(ExistingTargetOpts, TargetOpts, ModuleFilename, nullptr, AllowCompatibleDifferences); } bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override { return checkModuleCachePath( FileMgr.getVirtualFileSystem(), SpecificModuleCachePath, - ExistingModuleCachePath, nullptr, ExistingLangOpts, ExistingPPOpts); + ExistingModuleCachePath, ModuleFilename, nullptr, ExistingLangOpts, ExistingPPOpts); } bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override { return checkPreprocessorOptions( - PPOpts, ExistingPPOpts, ReadMacros, /*Diags=*/nullptr, FileMgr, + PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros, /*Diags=*/nullptr, FileMgr, SuggestedPredefines, ExistingLangOpts, StrictOptionMatches ? OptionValidateStrictMatches : OptionValidateContradictions); @@ -5457,7 +5462,7 @@ bool ASTReader::readASTFileControlBlock( switch (Entry.ID) { case OPTIONS_BLOCK_ID: { std::string IgnoredSuggestedPredefines; - if (ReadOptionsBlock(Stream, ClientLoadCapabilities, + if (ReadOptionsBlock(Stream, Filename, ClientLoadCapabilities, /*AllowCompatibleConfigurationMismatch*/ false, Listener, IgnoredSuggestedPredefines) != Success) return true; @@ -5683,7 +5688,7 @@ bool ASTReader::readASTFileControlBlock( // Scan for the UNHASHED_CONTROL_BLOCK_ID block. if (readUnhashedControlBlockImpl( - nullptr, Bytes, ClientLoadCapabilities, + nullptr, Bytes, Filename, ClientLoadCapabilities, /*AllowCompatibleConfigurationMismatch*/ false, &Listener, ValidateDiagnosticOptions) != Success) return true; @@ -6024,7 +6029,7 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F, /// /// \returns true if the listener deems the file unacceptable, false otherwise. bool ASTReader::ParseLanguageOptions(const RecordData &Record, - bool Complain, + StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener, bool AllowCompatibleDifferences) { LangOptions LangOpts; @@ -6061,11 +6066,11 @@ bool ASTReader::ParseLanguageOptions(const RecordData &Record, LangOpts.OMPHostIRFile = ReadString(Record, Idx); - return Listener.ReadLanguageOptions(LangOpts, Complain, + return Listener.ReadLanguageOptions(LangOpts, ModuleFilename, Complain, AllowCompatibleDifferences); } -bool ASTReader::ParseTargetOptions(const RecordData &Record, bool Complain, +bool ASTReader::ParseTargetOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener, bool AllowCompatibleDifferences) { unsigned Idx = 0; @@ -6081,11 +6086,11 @@ bool ASTReader::ParseTargetOptions(const RecordData &Record, bool Complain, TargetOpts.Features.push_back(ReadString(Record, Idx)); } - return Listener.ReadTargetOptions(TargetOpts, Complain, + return Listener.ReadTargetOptions(TargetOpts, ModuleFilename, Complain, AllowCompatibleDifferences); } -bool ASTReader::ParseDiagnosticOptions(const RecordData &Record, bool Complain, +bool ASTReader::ParseDiagnosticOptions(const RecordData &Record, StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener) { IntrusiveRefCntPtr DiagOpts(new DiagnosticOptions); unsigned Idx = 0; @@ -6099,7 +6104,7 @@ bool ASTReader::ParseDiagnosticOptions(const RecordData &Record, bool Complain, for (unsigned N = Record[Idx++]; N; --N) DiagOpts->Remarks.push_back(ReadString(Record, Idx)); - return Listener.ReadDiagnosticOptions(DiagOpts, Complain); + return Listener.ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain); } bool ASTReader::ParseFileSystemOptions(const RecordData &Record, bool Complain, @@ -6111,7 +6116,7 @@ bool ASTReader::ParseFileSystemOptions(const RecordData &Record, bool Complain, } bool ASTReader::ParseHeaderSearchOptions(const RecordData &Record, - bool Complain, + StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener) { HeaderSearchOptions HSOpts; unsigned Idx = 0; @@ -6130,7 +6135,7 @@ bool ASTReader::ParseHeaderSearchOptions(const RecordData &Record, HSOpts.UseLibcxx = Record[Idx++]; std::string SpecificModuleCachePath = ReadString(Record, Idx); - return Listener.ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath, + return Listener.ReadHeaderSearchOptions(HSOpts, ModuleFilename, SpecificModuleCachePath, Complain); } @@ -6167,7 +6172,7 @@ bool ASTReader::ParseHeaderSearchPaths(const RecordData &Record, bool Complain, } bool ASTReader::ParsePreprocessorOptions(const RecordData &Record, - bool Complain, + StringRef ModuleFilename, bool Complain, ASTReaderListener &Listener, std::string &SuggestedPredefines) { PreprocessorOptions PPOpts; @@ -6199,7 +6204,7 @@ bool ASTReader::ParsePreprocessorOptions(const RecordData &Record, PPOpts.ObjCXXARCStandardLibrary = static_cast(Record[Idx++]); SuggestedPredefines.clear(); - return Listener.ReadPreprocessorOptions(PPOpts, ReadMacros, Complain, + return Listener.ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros, Complain, SuggestedPredefines); } diff --git a/clang/test/Modules/check-for-sanitizer-feature.cpp b/clang/test/Modules/check-for-sanitizer-feature.cpp index 2137b1bf36bb8..861b571f0efaa 100644 --- a/clang/test/Modules/check-for-sanitizer-feature.cpp +++ b/clang/test/Modules/check-for-sanitizer-feature.cpp @@ -43,7 +43,7 @@ // // Import the PCH without ASan enabled (we expect an error). // RUN: not %clang_cc1 -x c -include-pch %t.asan_pch %s -verify 2>&1 | FileCheck %s --check-prefix=PCH_MISMATCH -// PCH_MISMATCH: AST file was compiled with the target feature '-fsanitize=address' but the current translation unit is not +// PCH_MISMATCH: AST file '{{.*}}.asan_pch' was compiled with the target feature '-fsanitize=address' but the current translation unit is not // // Emit a PCH with UBSan enabled. // RUN: %clang_cc1 -x c -fsanitize=null %S/Inputs/check-for-sanitizer-feature/check.h -emit-pch -o %t.ubsan_pch diff --git a/clang/test/Modules/ignored_macros.m b/clang/test/Modules/ignored_macros.m index a87a11f89c314..33801dfa4f476 100644 --- a/clang/test/Modules/ignored_macros.m +++ b/clang/test/Modules/ignored_macros.m @@ -10,7 +10,7 @@ // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify // RUN: not %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 // RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err -// CHECK-CONFLICT: PCH was compiled with module cache path +// CHECK-CONFLICT: AST file '{{.*}}' was compiled with module cache path // Third trial: pass -DIGNORED=1 only to the second invocation, but // make it ignored. There should be no failure, IGNORED is defined in diff --git a/clang/test/Modules/load_failure.c b/clang/test/Modules/load_failure.c index 3a8d29597348d..662b39b6f1874 100644 --- a/clang/test/Modules/load_failure.c +++ b/clang/test/Modules/load_failure.c @@ -15,7 +15,7 @@ // RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out // FIXME: Clean up diagnostic text below and give it a location -// CHECK-FAILURE: error: C99 was disabled in PCH file but is currently enabled +// CHECK-FAILURE: error: C99 was disabled in AST file '{{.*}}load_failure.pcm' but is currently enabled // FIXME: When we have a syntax for modules in C, use that. diff --git a/clang/test/Modules/merge-target-features.cpp b/clang/test/Modules/merge-target-features.cpp index 6a29c2db8a8d9..cc2bbfa077e98 100644 --- a/clang/test/Modules/merge-target-features.cpp +++ b/clang/test/Modules/merge-target-features.cpp @@ -20,7 +20,7 @@ // RUN: -target-cpu i386 \ // RUN: -fsyntax-only merge-target-features.cpp 2>&1 \ // RUN: | FileCheck --check-prefix=SUBSET --implicit-check-not=error: %s -// SUBSET: error: AST file was compiled with the target feature '+sse2' but the current translation unit is not +// SUBSET: error: AST file '{{.*}}foo.pcm' was compiled with the target feature '+sse2' but the current translation unit is not // SUBSET: error: {{.*}} configuration mismatch // // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ @@ -57,8 +57,8 @@ // RUN: -target-cpu i386 -target-feature +cx16 \ // RUN: -fsyntax-only merge-target-features.cpp 2>&1 \ // RUN: | FileCheck --check-prefix=MISMATCH --implicit-check-not=error: %s -// MISMATCH: error: AST file was compiled with the target feature '+sse2' but the current translation unit is not -// MISMATCH: error: current translation unit is compiled with the target feature '+cx16' but the AST file was not +// MISMATCH: error: AST file '{{.*}}foo.pcm' was compiled with the target feature '+sse2' but the current translation unit is not +// MISMATCH: error: current translation unit is compiled with the target feature '+cx16' but the AST file '{{.*}}foo.pcm' was not // MISMATCH: error: {{.*}} configuration mismatch #include "foo.h" diff --git a/clang/test/Modules/mismatch-diagnostics.cpp b/clang/test/Modules/mismatch-diagnostics.cpp index 5a026aa1f6c02..dffd4b46a678e 100644 --- a/clang/test/Modules/mismatch-diagnostics.cpp +++ b/clang/test/Modules/mismatch-diagnostics.cpp @@ -29,5 +29,5 @@ export module mismatching_module; //--- use.cpp import mismatching_module; -// CHECK: error: POSIX thread support was enabled in PCH file but is currently disabled +// CHECK: error: POSIX thread support was enabled in AST file '{{.*[/|\\\\]}}mismatching_module.pcm' but is currently disabled // CHECK-NEXT: module file {{.*[/|\\\\]}}mismatching_module.pcm cannot be loaded due to a configuration mismatch with the current compilation diff --git a/clang/test/Modules/module-pch-different-cache-path.c b/clang/test/Modules/module-pch-different-cache-path.c index 8778adc886f71..8dd04a166eab6 100644 --- a/clang/test/Modules/module-pch-different-cache-path.c +++ b/clang/test/Modules/module-pch-different-cache-path.c @@ -14,5 +14,5 @@ pch_int x = 0; -// CHECK-ERROR: PCH was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}' -// CHECK-SUCCESS-NOT: PCH was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}' +// CHECK-ERROR: AST file '{{.*}}' was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}' +// CHECK-SUCCESS-NOT: AST file '{{.*}}' was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}' diff --git a/clang/test/Modules/pr62359.cppm b/clang/test/Modules/pr62359.cppm index 69acc3ce303a5..7d9d3eec26cca 100644 --- a/clang/test/Modules/pr62359.cppm +++ b/clang/test/Modules/pr62359.cppm @@ -43,7 +43,7 @@ int use() { return 0; } -// CHECK: OpenMP{{.*}}differs in PCH file vs. current file +// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file //--- use2.cpp // expected-no-diagnostics @@ -55,5 +55,5 @@ int use2() { return 0; } -// CHECK: OpenMP{{.*}}differs in PCH file vs. current file +// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file // CHECK: use of undeclared identifier 'pragma' diff --git a/clang/test/PCH/arc.m b/clang/test/PCH/arc.m index 32069e2314164..e4ad71a469b95 100644 --- a/clang/test/PCH/arc.m +++ b/clang/test/PCH/arc.m @@ -14,5 +14,5 @@ array0 a0; array1 a1; -// CHECK-ERR1: Objective-C automated reference counting was enabled in PCH file but is currently disabled -// CHECK-ERR2: Objective-C automated reference counting was disabled in PCH file but is currently enabled +// CHECK-ERR1: Objective-C automated reference counting was enabled in AST file '{{.*}}' but is currently disabled +// CHECK-ERR2: Objective-C automated reference counting was disabled in AST file '{{.*}}' but is currently enabled diff --git a/clang/test/PCH/fuzzy-pch.c b/clang/test/PCH/fuzzy-pch.c index 7296d1dc893b3..53985866dc08e 100644 --- a/clang/test/PCH/fuzzy-pch.c +++ b/clang/test/PCH/fuzzy-pch.c @@ -24,8 +24,8 @@ BAR bar = 17; # error BAR was not defined #endif -// CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah') -// CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line +// CHECK-FOO: definition of macro 'FOO' differs between the AST file '{{.*}}' ('1') and the command line ('blah') +// CHECK-NOFOO: macro 'FOO' was defined in the AST file '{{.*}}' but undef'd on the command line -// CHECK-UNDEF: command line contains '-undef' but precompiled header was not built with it +// CHECK-UNDEF: command line contains '-undef' but AST file '{{.*}}' was not built with it diff --git a/clang/test/PCH/module-hash-difference.m b/clang/test/PCH/module-hash-difference.m index fc542b0e8d1ad..73cf536f88b4f 100644 --- a/clang/test/PCH/module-hash-difference.m +++ b/clang/test/PCH/module-hash-difference.m @@ -4,5 +4,5 @@ // RUN: not %clang_cc1 -fsyntax-only -include-pch %t.pch %s -I %S/Inputs/modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash 2> %t.err // RUN: FileCheck -input-file=%t.err %s -// CHECK: error: PCH was compiled with module cache path {{.*}}, but the path is currently {{.*}} +// CHECK: error: AST file '{{.*}}' was compiled with module cache path {{.*}}, but the path is currently {{.*}} @import Foo; diff --git a/clang/test/PCH/ms-pch-macro.c b/clang/test/PCH/ms-pch-macro.c index a512e66e24866..4d4900cc4f90d 100644 --- a/clang/test/PCH/ms-pch-macro.c +++ b/clang/test/PCH/ms-pch-macro.c @@ -33,7 +33,7 @@ BAR bar = 17; # error BAR was not defined #endif -// CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah') -// CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line +// CHECK-FOO: definition of macro 'FOO' differs between the AST file '{{.*}}1.pch' ('1') and the command line ('blah') +// CHECK-NOFOO: macro 'FOO' was defined in the AST file '{{.*}}1.pch' but undef'd on the command line // expected-warning@2 {{definition of macro 'BAR' does not match definition in precompiled header}} diff --git a/clang/test/PCH/no-validate-pch.cl b/clang/test/PCH/no-validate-pch.cl index 26c5fd5cc04c2..aa228ee205219 100644 --- a/clang/test/PCH/no-validate-pch.cl +++ b/clang/test/PCH/no-validate-pch.cl @@ -16,8 +16,8 @@ // CHECK: note: previous definition is here // CHECK: #define X 4 -// CHECK-VAL: error: __OPTIMIZE__ predefined macro was enabled in PCH file but is currently disabled -// CHECK-VAL: error: definition of macro 'X' differs between the precompiled header ('4') and the command line ('5') +// CHECK-VAL: error: __OPTIMIZE__ predefined macro was enabled in AST file '{{.*}}' but is currently disabled +// CHECK-VAL: error: definition of macro 'X' differs between the AST file '{{.*}}' ('4') and the command line ('5') void test(void) { int a = ONE;