llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clangd Author: Michael Spencer (Bigcheese) <details> <summary>Changes</summary> This patch deprecates `module.map` in favor of `module.modulemap`, which has been the preferred form since 2014. The eventual goal is to remove support for `module.map` to reduce the number of stats Clang needs to do while searching for module map files. This patch touches a lot of files, but the majority of them are just renaming tests or references to the file in comments or documentation. The relevant files are: * lib/Lex/HeaderSearch.cpp * include/clang/Basic/DiagnosticGroups.td * include/clang/Basic/DiagnosticLexKinds.td --- Patch is 108.34 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/75142.diff 142 Files Affected: - (modified) clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp (+2-2) - (modified) clang-tools-extra/docs/modularize.rst (+1-1) - (renamed) clang-tools-extra/include-cleaner/test/Inputs/modules/module.modulemap () - (modified) clang-tools-extra/modularize/Modularize.cpp (+6-6) - (modified) clang-tools-extra/modularize/ModularizeUtilities.cpp (+2-2) - (modified) clang-tools-extra/modularize/ModularizeUtilities.h (+2-2) - (modified) clang-tools-extra/test/modularize/Inputs/CompileError/module.modulemap (+1-1) - (modified) clang-tools-extra/test/modularize/Inputs/CoverageNoProblems/module.modulemap (+1-1) - (modified) clang-tools-extra/test/modularize/Inputs/CoverageProblems/module.modulemap (+1-1) - (modified) clang-tools-extra/test/modularize/Inputs/MissingHeader/module.modulemap (+1-1) - (renamed) clang-tools-extra/test/pp-trace/Inputs/module.modulemap (+1-1) - (modified) clang/include/clang-c/BuildSystem.h (+3-3) - (modified) clang/include/clang/Basic/DiagnosticGroups.td (+1) - (modified) clang/include/clang/Basic/DiagnosticLexKinds.td (+3) - (modified) clang/lib/Lex/HeaderSearch.cpp (+17-5) - (renamed) clang/test/ARCMT/Inputs/module.modulemap () - (renamed) clang/test/Index/Inputs/Frameworks/module.modulemap () - (renamed) clang/test/Index/Inputs/Headers/module.modulemap () - (renamed) clang/test/Index/Inputs/Headers/nested/module.modulemap () - (renamed) clang/test/Index/Inputs/module.modulemap () - (modified) clang/test/Index/Inputs/vfsoverlay.yaml (+2-2) - (renamed) clang/test/Modules/Inputs/Conflicts/module.modulemap () - (renamed) clang/test/Modules/Inputs/DependsOnModule.framework/Modules/module.modulemap () - (renamed) clang/test/Modules/Inputs/DependsOnModule.framework/Modules/module.private.modulemap () - (renamed) clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Modules/module.modulemap () - (renamed) clang/test/Modules/Inputs/Modified/module.modulemap () - (renamed) clang/test/Modules/Inputs/ModuleDiags/module.modulemap () - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/a.h (+1) - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module.map (+3) - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module_private.map (+3) - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/private.h () - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/Headers/a.h () - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/PrivateHeaders/private.h () - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module.map (+3) - (added) clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module_private.map (+3) - (renamed) clang/test/Modules/Inputs/NoUmbrella.framework/Modules/module.modulemap () - (renamed) clang/test/Modules/Inputs/NoUmbrella.framework/Modules/module.private.modulemap () - (renamed) clang/test/Modules/Inputs/StdDef/module.modulemap () - (renamed) clang/test/Modules/Inputs/System/usr/include/module.modulemap () - (renamed) clang/test/Modules/Inputs/UseAfterFree/module.modulemap () - (renamed) clang/test/Modules/Inputs/UseAfterFree/module.private.modulemap () - (renamed) clang/test/Modules/Inputs/crash-recovery/usr/include/module.modulemap () - (renamed) clang/test/Modules/Inputs/declare-use/module.modulemap () - (renamed) clang/test/Modules/Inputs/elsewhere/module.modulemap () - (renamed) clang/test/Modules/Inputs/exclude-header/module.modulemap () - (renamed) clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/module.private.modulemap () - (renamed) clang/test/Modules/Inputs/include-relative/module.modulemap () - (renamed) clang/test/Modules/Inputs/lookup-assert-protocol/module.modulemap () - (renamed) clang/test/Modules/Inputs/lookup-assert/module.modulemap () - (renamed) clang/test/Modules/Inputs/macro-undef-through-pch/module.modulemap () - (renamed) clang/test/Modules/Inputs/malformed/module.modulemap () - (renamed) clang/test/Modules/Inputs/module.modulemap () - (renamed) clang/test/Modules/Inputs/ms-enums/module.modulemap () - (renamed) clang/test/Modules/Inputs/normal-module-map/Umbrella/module.modulemap () - (renamed) clang/test/Modules/Inputs/normal-module-map/Umbrella2/module.modulemap () - (renamed) clang/test/Modules/Inputs/normal-module-map/module.modulemap () - (renamed) clang/test/Modules/Inputs/normal-module-map/nested/module.modulemap () - (renamed) clang/test/Modules/Inputs/objc-category-2/module.modulemap () - (renamed) clang/test/Modules/Inputs/objc-category-3/module.modulemap () - (renamed) clang/test/Modules/Inputs/objc-category/module.modulemap () - (renamed) clang/test/Modules/Inputs/objc-hidden/System/module.modulemap () - (renamed) clang/test/Modules/Inputs/odr/module.modulemap () - (renamed) clang/test/Modules/Inputs/oldname/module.modulemap () - (renamed) clang/test/Modules/Inputs/pr19692/module.modulemap () - (renamed) clang/test/Modules/Inputs/private/module.modulemap () - (renamed) clang/test/Modules/Inputs/private1/module.modulemap () - (renamed) clang/test/Modules/Inputs/private2/module.modulemap () - (renamed) clang/test/Modules/Inputs/redecls/module.modulemap () - (renamed) clang/test/Modules/Inputs/self-import-header/af.framework/Modules/module.modulemap () - (renamed) clang/test/Modules/Inputs/self-import-header/depend_builtin/module.modulemap () - (renamed) clang/test/Modules/Inputs/string_names/module.modulemap () - (renamed) clang/test/Modules/Inputs/subdir/module.modulemap () - (renamed) clang/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/module.modulemap () - (renamed) clang/test/Modules/Inputs/submodules/module.modulemap () - (renamed) clang/test/Modules/Inputs/system-out-of-date/module.modulemap () - (renamed) clang/test/Modules/Inputs/template-specialization-visibility/module.modulemap () - (renamed) clang/test/Modules/Inputs/thread-safety/module.modulemap () - (renamed) clang/test/Modules/Inputs/undefined-type-fixit/module.modulemap () - (renamed) clang/test/Modules/Inputs/unnecessary-module-map-parsing/module.modulemap () - (renamed) clang/test/Modules/Inputs/update-after-load/module.modulemap () - (renamed) clang/test/Modules/Inputs/wildcard-submodule-exports/module.modulemap () - (modified) clang/test/Modules/concept_differ.cpp (+2-2) - (modified) clang/test/Modules/config_macros.m (+1-1) - (modified) clang/test/Modules/crash-vfs-ivfsoverlay.m (+1-1) - (modified) clang/test/Modules/crash-vfs-path-symlink-component.m (+2-2) - (modified) clang/test/Modules/crash-vfs-path-traversal.m (+2-2) - (modified) clang/test/Modules/crash-vfs-relative-incdir.m (+2-2) - (modified) clang/test/Modules/crash-vfs-relative-overlay.m (+2-2) - (modified) clang/test/Modules/crash-vfs-run-reproducer.m (+2-2) - (modified) clang/test/Modules/declare-use-compatible.cpp (+4-4) - (modified) clang/test/Modules/dependency-gen-pch.m (+1-1) - (modified) clang/test/Modules/dependency-gen.m (+4-4) - (modified) clang/test/Modules/diag-flags.cpp (+6-6) - (modified) clang/test/Modules/diag-pragma.c (+1-1) - (modified) clang/test/Modules/diag-pragma.cpp (+2-2) - (modified) clang/test/Modules/diamond-pch.c (+4-4) - (modified) clang/test/Modules/diamond.c (+4-4) - (modified) clang/test/Modules/extern_c_bad.cpp (+1-1) - (modified) clang/test/Modules/fmodules-validate-once-per-build-session.c (+3-3) - (modified) clang/test/Modules/fsystem-module.m (+3-3) - (modified) clang/test/Modules/irgen.c (+1-1) - (modified) clang/test/Modules/linkage-merge.m (+1-1) - (modified) clang/test/Modules/load_failure.c (+1-1) - (modified) clang/test/Modules/lookup.cpp (+2-2) - (modified) clang/test/Modules/lookup.m (+2-2) - (modified) clang/test/Modules/merge-concepts.cppm (+6-6) - (modified) clang/test/Modules/missing-header.m (+1-1) - (modified) clang/test/Modules/modify-module.m (+1-1) - (modified) clang/test/Modules/module-file-home-is-cwd.m (+3-3) - (modified) clang/test/Modules/module-private.cpp (+2-2) - (modified) clang/test/Modules/module_file_info.m (+4-4) - (modified) clang/test/Modules/modulemap-locations.m (+4) - (modified) clang/test/Modules/no-stale-modtime.m (+3-3) - (modified) clang/test/Modules/objc-at-keyword.m (+2-2) - (modified) clang/test/Modules/objc-categories.m (+5-5) - (modified) clang/test/Modules/objc-type-param.m (+1-1) - (modified) clang/test/Modules/objc_redef.m (+2-2) - (modified) clang/test/Modules/odr_hash-blocks.cpp (+6-6) - (modified) clang/test/Modules/odr_hash-gnu.cpp (+6-6) - (modified) clang/test/Modules/odr_hash-vector.cpp (+6-6) - (modified) clang/test/Modules/odr_hash.cl (+6-6) - (modified) clang/test/Modules/odr_hash.cpp (+6-6) - (modified) clang/test/Modules/odr_hash.mm (+6-6) - (modified) clang/test/Modules/pragma-pack.cpp (+2-2) - (modified) clang/test/Modules/recursive.c (+1-1) - (modified) clang/test/Modules/redecl-namespaces.mm (+2-2) - (modified) clang/test/Modules/redeclarations.m (+2-2) - (modified) clang/test/Modules/relative-submodule-topheader.m (+1-1) - (modified) clang/test/Modules/requires-coroutines.mm (+1-1) - (modified) clang/test/Modules/requires-gnuinlineasm.m (+1-1) - (modified) clang/test/Modules/requires.m (+15-15) - (modified) clang/test/Modules/requires.mm (+2-2) - (modified) clang/test/Modules/target-platform-features.m (+32-32) - (modified) clang/test/Modules/timestamps.c (+1-1) - (modified) clang/test/Modules/validate-system-headers.m (+1-1) - (modified) clang/test/PCH/modified-module-dependency.m (+1-1) - (modified) clang/test/Preprocessor/pragma_module.c (+4-4) - (renamed) clang/test/SemaObjC/Inputs/module.modulemap () - (modified) clang/test/VFS/Inputs/vfsoverlay.yaml (+1-1) - (modified) clang/test/VFS/Inputs/vfsoverlay2.yaml (+1-1) - (modified) clang/test/VFS/test_nonmodular.c (+1-1) - (modified) clang/unittests/Tooling/ToolingTest.cpp (+5-5) ``````````diff diff --git a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp index f12441061c1983..9cdc57ec01f327 100644 --- a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp +++ b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp @@ -1917,14 +1917,14 @@ TEST_F(SymbolCollectorTest, UndefOfModuleMacro) { #undef X )cpp"; TU.AdditionalFiles["foo.h"] = "#define X 1"; - TU.AdditionalFiles["module.map"] = R"cpp( + TU.AdditionalFiles["module.modulemap"] = R"cpp( module foo { header "foo.h" export * } )cpp"; TU.ExtraArgs.push_back("-fmodules"); - TU.ExtraArgs.push_back("-fmodule-map-file=" + testPath("module.map")); + TU.ExtraArgs.push_back("-fmodule-map-file=" + testPath("module.modulemap")); TU.OverlayRealFileSystemForModules = true; TU.build(); diff --git a/clang-tools-extra/docs/modularize.rst b/clang-tools-extra/docs/modularize.rst index 9dde467ec30847..64ca8c99d4e8ef 100644 --- a/clang-tools-extra/docs/modularize.rst +++ b/clang-tools-extra/docs/modularize.rst @@ -20,7 +20,7 @@ map. :program:`modularize` also has an assistant mode option for generating a module map file based on the provided header list. The generated file is a functional module map that can be used as a starting point for a -module.map file. +module.modulemap file. Getting Started =============== diff --git a/clang-tools-extra/include-cleaner/test/Inputs/modules/module.map b/clang-tools-extra/include-cleaner/test/Inputs/modules/module.modulemap similarity index 100% rename from clang-tools-extra/include-cleaner/test/Inputs/modules/module.map rename to clang-tools-extra/include-cleaner/test/Inputs/modules/module.modulemap diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp index daa9c048279e03..f3e7dfc20b027d 100644 --- a/clang-tools-extra/modularize/Modularize.cpp +++ b/clang-tools-extra/modularize/Modularize.cpp @@ -51,20 +51,20 @@ // to the header list file directory. Use -prefix to specify a // different directory. // -module-map-path=(module map) -// Skip the checks, and instead act as a module.map generation +// Skip the checks, and instead act as a module.modulemap generation // assistant, generating a module map file based on the header list. // An optional "-root-module=(rootName)" argument can specify a root -// module to be created in the generated module.map file. Note that -// you will likely need to edit this file to suit the needs of your -// headers. +// module to be created in the generated module.modulemap file. Note +// that you will likely need to edit this file to suit the needs of +// your headers. // -problem-files-list=(problem files list file name) // For use only with module map assistant. Input list of files that // have problems with respect to modules. These will still be // included in the generated module map, but will be marked as // "excluded" headers. // -root-module=(root module name) -// Specifies a root module to be created in the generated module.map -// file. +// Specifies a root module to be created in the generated +// module.modulemap file. // -block-check-header-list-only // Only warn if #include directives are inside extern or namespace // blocks if the included header is in the header list. diff --git a/clang-tools-extra/modularize/ModularizeUtilities.cpp b/clang-tools-extra/modularize/ModularizeUtilities.cpp index 089f52f52ec4d3..e65f711249e3f5 100644 --- a/clang-tools-extra/modularize/ModularizeUtilities.cpp +++ b/clang-tools-extra/modularize/ModularizeUtilities.cpp @@ -103,10 +103,10 @@ std::error_code ModularizeUtilities::loadAllHeaderListsAndDependencies() { // Do coverage checks. // For each loaded module map, do header coverage check. -// Starting from the directory of the module.map file, +// Starting from the directory of the module.modulemap file, // Find all header files, optionally looking only at files // covered by the include path options, and compare against -// the headers referenced by the module.map file. +// the headers referenced by the module.modulemap file. // Display warnings for unaccounted-for header files. // Returns 0 if there were no errors or warnings, 1 if there // were warnings, 2 if any other problem, such as a bad diff --git a/clang-tools-extra/modularize/ModularizeUtilities.h b/clang-tools-extra/modularize/ModularizeUtilities.h index 6da15e42f1f1ea..64675022dad76e 100644 --- a/clang-tools-extra/modularize/ModularizeUtilities.h +++ b/clang-tools-extra/modularize/ModularizeUtilities.h @@ -89,10 +89,10 @@ class ModularizeUtilities { /// Do coverage checks. /// For each loaded module map, do header coverage check. - /// Starting from the directory of the module.map file, + /// Starting from the directory of the module.modulemap file, /// Find all header files, optionally looking only at files /// covered by the include path options, and compare against - /// the headers referenced by the module.map file. + /// the headers referenced by the module.modulemap file. /// Display warnings for unaccounted-for header files. /// \param IncludePaths The include paths to check for files. /// (Note that other directories above these paths are ignored. diff --git a/clang-tools-extra/test/modularize/Inputs/CompileError/module.modulemap b/clang-tools-extra/test/modularize/Inputs/CompileError/module.modulemap index fbb8e7db4d10c2..64180adf5beb35 100644 --- a/clang-tools-extra/test/modularize/Inputs/CompileError/module.modulemap +++ b/clang-tools-extra/test/modularize/Inputs/CompileError/module.modulemap @@ -1,4 +1,4 @@ -// module.map +// module.modulemap module Level1A { header "Level1A.h" diff --git a/clang-tools-extra/test/modularize/Inputs/CoverageNoProblems/module.modulemap b/clang-tools-extra/test/modularize/Inputs/CoverageNoProblems/module.modulemap index d2b0957b76e1ca..39af7d5dcf366e 100644 --- a/clang-tools-extra/test/modularize/Inputs/CoverageNoProblems/module.modulemap +++ b/clang-tools-extra/test/modularize/Inputs/CoverageNoProblems/module.modulemap @@ -1,4 +1,4 @@ -// module.map +// module.modulemap module Level1A { header "Includes1/Level1A.h" diff --git a/clang-tools-extra/test/modularize/Inputs/CoverageProblems/module.modulemap b/clang-tools-extra/test/modularize/Inputs/CoverageProblems/module.modulemap index dbe0bb8507cf0b..2b8b23054a0195 100644 --- a/clang-tools-extra/test/modularize/Inputs/CoverageProblems/module.modulemap +++ b/clang-tools-extra/test/modularize/Inputs/CoverageProblems/module.modulemap @@ -1,4 +1,4 @@ -// module.map +// module.modulemap module Level1A { header "Level1A.h" diff --git a/clang-tools-extra/test/modularize/Inputs/MissingHeader/module.modulemap b/clang-tools-extra/test/modularize/Inputs/MissingHeader/module.modulemap index daa06fca78d26b..9acb4923f9ac37 100644 --- a/clang-tools-extra/test/modularize/Inputs/MissingHeader/module.modulemap +++ b/clang-tools-extra/test/modularize/Inputs/MissingHeader/module.modulemap @@ -1,4 +1,4 @@ -// module.map +// module.modulemap module Level1A { header "Level1A.h" diff --git a/clang-tools-extra/test/pp-trace/Inputs/module.map b/clang-tools-extra/test/pp-trace/Inputs/module.modulemap similarity index 84% rename from clang-tools-extra/test/pp-trace/Inputs/module.map rename to clang-tools-extra/test/pp-trace/Inputs/module.modulemap index 31f33c5bb14902..f16bbc6e2e05b4 100644 --- a/clang-tools-extra/test/pp-trace/Inputs/module.map +++ b/clang-tools-extra/test/pp-trace/Inputs/module.modulemap @@ -1,4 +1,4 @@ -// module.map +// module.modulemap module Level1A { header "Level1A.h" diff --git a/clang/include/clang-c/BuildSystem.h b/clang/include/clang-c/BuildSystem.h index 296e61247cef57..57e16af20a7006 100644 --- a/clang/include/clang-c/BuildSystem.h +++ b/clang/include/clang-c/BuildSystem.h @@ -95,7 +95,7 @@ CINDEX_LINKAGE void clang_free(void *buffer); CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay); /** - * Object encapsulating information about a module.map file. + * Object encapsulating information about a module.modulemap file. */ typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor; @@ -109,7 +109,7 @@ CINDEX_LINKAGE CXModuleMapDescriptor clang_ModuleMapDescriptor_create(unsigned options); /** - * Sets the framework module name that the module.map describes. + * Sets the framework module name that the module.modulemap describes. * \returns 0 for success, non-zero to indicate an error. */ CINDEX_LINKAGE enum CXErrorCode @@ -117,7 +117,7 @@ clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor, const char *name); /** - * Sets the umbrella header name that the module.map describes. + * Sets the umbrella header name that the module.modulemap describes. * \returns 0 for success, non-zero to indicate an error. */ CINDEX_LINKAGE enum CXErrorCode diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index caee2dc6daadb6..80b5680b94f6ca 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -40,6 +40,7 @@ def : DiagGroup<"auto-import">; def FrameworkHdrQuotedInclude : DiagGroup<"quoted-include-in-framework-header">; def FrameworkIncludePrivateFromPublic : DiagGroup<"framework-include-private-from-public">; +def DeprecatedModuleDotMap : DiagGroup<"deprecated-module-dot-map">; def FrameworkHdrAtImport : DiagGroup<"atimport-in-framework-header">; def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">; def CXXPre14CompatBinaryLiteral : DiagGroup<"c++98-c++11-compat-binary-literal">; diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td index 564ca48cc32ac5..75ca2fa16d3485 100644 --- a/clang/include/clang/Basic/DiagnosticLexKinds.td +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -884,6 +884,9 @@ def warn_quoted_include_in_framework_header : Warning< def warn_framework_include_private_from_public : Warning< "public framework header includes private framework header '%0'" >, InGroup<FrameworkIncludePrivateFromPublic>; +def warn_deprecated_module_dot_map : Warning< + "'%0' as a module map name is deprecated, rename it to %select{module.modulemap|module.private.modulemap}1%select{| in the 'Modules' directory of the framework}2">, + InGroup<DeprecatedModuleDotMap>; def remark_pp_include_directive_modular_translation : Remark< "treating #%select{include|import|include_next|__include_macros}0 as an " diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index c03cf19688d961..bf619bb1bb8300 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -1656,7 +1656,8 @@ bool HeaderSearch::findUsableModuleForFrameworkHeader( } static OptionalFileEntryRef getPrivateModuleMap(FileEntryRef File, - FileManager &FileMgr) { + FileManager &FileMgr, + DiagnosticsEngine &Diags) { StringRef Filename = llvm::sys::path::filename(File.getName()); SmallString<128> PrivateFilename(File.getDir().getName()); if (Filename == "module.map") @@ -1665,7 +1666,14 @@ static OptionalFileEntryRef getPrivateModuleMap(FileEntryRef File, llvm::sys::path::append(PrivateFilename, "module.private.modulemap"); else return std::nullopt; - return FileMgr.getOptionalFileRef(PrivateFilename); + auto PMMFile = FileMgr.getOptionalFileRef(PrivateFilename); + if (PMMFile) { + if (Filename == "module.map") + Diags.Report(diag::warn_deprecated_module_dot_map) + << PrivateFilename << 1 + << File.getDir().getName().endswith(".framework"); + } + return PMMFile; } bool HeaderSearch::loadModuleMapFile(FileEntryRef File, bool IsSystem, @@ -1731,7 +1739,8 @@ HeaderSearch::loadModuleMapFileImpl(FileEntryRef File, bool IsSystem, } // Try to load a corresponding private module map. - if (OptionalFileEntryRef PMMFile = getPrivateModuleMap(File, FileMgr)) { + if (OptionalFileEntryRef PMMFile = + getPrivateModuleMap(File, FileMgr, Diags)) { if (ModMap.parseModuleMapFile(*PMMFile, IsSystem, Dir)) { LoadedModuleMaps[File] = false; return LMM_InvalidModuleMap; @@ -1755,11 +1764,14 @@ HeaderSearch::lookupModuleMapFile(DirectoryEntryRef Dir, bool IsFramework) { if (auto F = FileMgr.getOptionalFileRef(ModuleMapFileName)) return *F; - // Continue to allow module.map + // Continue to allow module.map, but warn it's deprecated. ModuleMapFileName = Dir.getName(); llvm::sys::path::append(ModuleMapFileName, "module.map"); - if (auto F = FileMgr.getOptionalFileRef(ModuleMapFileName)) + if (auto F = FileMgr.getOptionalFileRef(ModuleMapFileName)) { + Diags.Report(diag::warn_deprecated_module_dot_map) + << ModuleMapFileName << 0 << IsFramework; return *F; + } // For frameworks, allow to have a private module map with a preferred // spelling when a public module map is absent. diff --git a/clang/test/ARCMT/Inputs/module.map b/clang/test/ARCMT/Inputs/module.modulemap similarity index 100% rename from clang/test/ARCMT/Inputs/module.map rename to clang/test/ARCMT/Inputs/module.modulemap diff --git a/clang/test/Index/Inputs/Frameworks/module.map b/clang/test/Index/Inputs/Frameworks/module.modulemap similarity index 100% rename from clang/test/Index/Inputs/Frameworks/module.map rename to clang/test/Index/Inputs/Frameworks/module.modulemap diff --git a/clang/test/Index/Inputs/Headers/module.map b/clang/test/Index/Inputs/Headers/module.modulemap similarity index 100% rename from clang/test/Index/Inputs/Headers/module.map rename to clang/test/Index/Inputs/Headers/module.modulemap diff --git a/clang/test/Index/Inputs/Headers/nested/module.map b/clang/test/Index/Inputs/Headers/nested/module.modulemap similarity index 100% rename from clang/test/Index/Inputs/Headers/nested/module.map rename to clang/test/Index/Inputs/Headers/nested/module.modulemap diff --git a/clang/test/Index/Inputs/module.map b/clang/test/Index/Inputs/module.modulemap similarity index 100% rename from clang/test/Index/Inputs/module.map rename to clang/test/Index/Inputs/module.modulemap diff --git a/clang/test/Index/Inputs/vfsoverlay.yaml b/clang/test/Index/Inputs/vfsoverlay.yaml index 95b00bef7d0e4c..3e9718b4c4314f 100644 --- a/clang/test/Index/Inputs/vfsoverlay.yaml +++ b/clang/test/Index/Inputs/vfsoverlay.yaml @@ -3,8 +3,8 @@ 'roots': [ { 'name': 'OUT_DIR', 'type': 'directory', 'contents': [ - { 'name': 'module.map', 'type': 'file', - 'external-contents': 'INPUT_DIR/module.map' + { 'name': 'module.modulemap', 'type': 'file', + 'external-contents': 'INPUT_DIR/module.modulemap' }, { 'name': 'ModuleNeedsVFS.h', 'type': 'file', 'external-contents': 'INPUT_DIR/module_needs_vfs.h' diff --git a/clang/test/Modules/Inputs/Conflicts/module.map b/clang/test/Modules/Inputs/Conflicts/module.modulemap similarity index 100% rename from clang/test/Modules/Inputs/Conflicts/module.map rename to clang/test/Modules/Inputs/Conflicts/module.modulemap diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/module.map b/clang/test/Modules/Inputs/DependsOnModule.framework/Modules/module.modulemap similarity index 100% rename from clang/test/Modules/Inputs/DependsOnModule.framework/module.map rename to clang/test/Modules/Inputs/DependsOnModule.framework/Modules/module.modulemap diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/module_private.map b/clang/test/Modules/Inputs/DependsOnModule.framework/Modules/module.private.modulemap similarity index 100% rename from clang/test/Modules/Inputs/DependsOnModule.framework/module_private.map rename to clang/test/Modules/Inputs/DependsOnModule.framework/Modules/module.private.modulemap diff --git a/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Modules/module.modulemap similarity index 100% rename from clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map rename to clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Modules/module.modulemap diff --git a/clang/test/Modules/Inputs/Modified/module.map b/clang/test/Modules/Inputs/Modified/module.modulemap similarity index 100% rename from clang/test/Modules/Inputs/Modified/module.map rename to clang/test/Modules/Inputs/Modified/module.modulemap diff --git a/clang/test/Modules/Inputs/ModuleDiags/module.map b/clang/test/Modules/Inputs/ModuleDiags/module.modulemap similarity index 100% rename from clang/test/Modules/Inputs/ModuleDiags/module.map rename to clang/test/Modules/Inputs/ModuleDiags/module.modulemap diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/a.h b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/a.h new file mode 100644 index 00000000000000..d571c6e4f799f3 --- /dev/null +++ b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/a.h @@ -0,0 +1 @@ +void will_be_found1(void); diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module.map b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module.map new file mode 100644 index 00000000000000..ef46443cedc925 --- /dev/null +++ b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module.map @@ -0,0 +1,3 @@ +module module_map { + header "a.h" +} diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module_private.map b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module_private.map new file mode 100644 index 00000000000000..d542172a1235e7 --- /dev/null +++ b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/module_private.map @@ -0,0 +1,3 @@ +module module_map.Private { + header "private.h" +} diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/private.h b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map/private.h new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/Headers/a.h b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/Headers/a.h new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/PrivateHeaders/private.h b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/PrivateHeaders/private.h new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module.map b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module.map new file mode 100644 index 00000000000000..f30545f8a88cdd --- /dev/null +++ b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module.map @@ -0,0 +1,3 @@ +framework module Module_Map_F { + header "a.h" +} diff --git a/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module_private.map b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module_private.map new file mode 100644 index 00000000000000..0b3b5a78b8741d --- /dev/null +++ b/clang/test/Modules/Inputs/ModuleMapLocations/Module_Map_F.framework/module_private.map @@ -0,0 +1,3 @@ +explicit framework module Module_Map_F.Private { + header "private.h" +} diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/module.map b/clang/test/Modules/Inputs/NoUmbrella.framework/Modules/module.modulemap similarity index 100% rename from clang/test/Modules/Inputs/NoUmbrella.framework/module.map rename to clang/test/Modules/Inputs/NoUmbrella.framework/Modules/module.modulemap diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/module_private.map b/clang/test/Modules/Inputs/NoUmbrella.framework/Modules/module.private.modulemap similarity index 100% rename from clang/test/Modules/Inputs/NoUmbrella.framework/module_private.map rename to clang/test/Modules/Inputs/NoUmbrella.framework/Modules/module.priv... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/75142 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits