[PATCH] D150478: [clang][modules][deps] Parse "FW_Private" module map even after loading "FW" PCM
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 11 08:35:56 PDT 2023
jansvoboda11 updated this revision to Diff 539127.
jansvoboda11 added a comment.
Expose new preprocessor option as a `-cc1` flag, move test from `ClangScanDeps` to `Modules` directory.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150478/new/
https://reviews.llvm.org/D150478
Files:
clang/include/clang/Driver/Options.td
clang/lib/Lex/HeaderSearch.cpp
clang/test/Modules/no-check-relocated-fw-private.c
Index: clang/test/Modules/no-check-relocated-fw-private.c
===================================================================
--- /dev/null
+++ clang/test/Modules/no-check-relocated-fw-private.c
@@ -0,0 +1,23 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+//--- frameworks1/FW1.framework/Modules/module.modulemap
+framework module FW1 { header "FW1.h" }
+//--- frameworks1/FW1.framework/Headers/FW1.h
+#import <FW2/FW2.h>
+
+//--- frameworks2/FW2.framework/Modules/module.modulemap
+framework module FW2 { header "FW2.h" }
+//--- frameworks2/FW2.framework/Modules/module.private.modulemap
+framework module FW2_Private { header "FW2_Private.h" }
+//--- frameworks2/FW2.framework/Headers/FW2.h
+//--- frameworks2/FW2.framework/PrivateHeaders/FW2_Private.h
+
+//--- tu.c
+#import <FW1/FW1.h> // expected-remark{{importing module 'FW1'}} \
+ // expected-remark{{importing module 'FW2'}}
+#import <FW2/FW2_Private.h> // expected-remark{{importing module 'FW2_Private'}}
+
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fimplicit-module-maps \
+// RUN: -F %t/frameworks1 -F %t/frameworks2 -fsyntax-only %t/tu.c \
+// RUN: -fno-modules-check-relocated -Rmodule-import -verify
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -1783,9 +1783,6 @@
Module *HeaderSearch::loadFrameworkModule(StringRef Name, DirectoryEntryRef Dir,
bool IsSystem) {
- if (Module *Module = ModMap.findModule(Name))
- return Module;
-
// Try to load a module map file.
switch (loadModuleMapFile(Dir, IsSystem, /*IsFramework*/true)) {
case LMM_InvalidModuleMap:
@@ -1794,10 +1791,10 @@
ModMap.inferFrameworkModule(Dir, IsSystem, /*Parent=*/nullptr);
break;
- case LMM_AlreadyLoaded:
case LMM_NoDirectory:
return nullptr;
+ case LMM_AlreadyLoaded:
case LMM_NewlyLoaded:
break;
}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2570,6 +2570,10 @@
defm implicit_modules : BoolFOption<"implicit-modules",
LangOpts<"ImplicitModules">, DefaultTrue,
NegFlag<SetFalse, [CC1Option]>, PosFlag<SetTrue>, BothFlags<[NoXarchOption,CoreOption]>>;
+def fno_modules_check_relocated : Joined<["-"], "fno-modules-check-relocated">,
+ Group<f_Group>, Flags<[CC1Option]>,
+ HelpText<"Skip checks for relocated modules when loading PCM files">,
+ MarshallingInfoNegativeFlag<PreprocessorOpts<"ModulesCheckRelocated">>;
def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-system-headers">, Group<f_Group>, Flags<[CC1Option]>,
MarshallingInfoFlag<LangOpts<"RetainCommentsFromSystemHeaders">>;
def fmodule_header : Flag <["-"], "fmodule-header">, Group<f_Group>,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150478.539127.patch
Type: text/x-patch
Size: 2983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230711/30ab6593/attachment-0001.bin>
More information about the cfe-commits
mailing list