[PATCH] D150479: [clang][modules][deps] Allow skipping submodule definitions
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 12 13:42:39 PDT 2023
jansvoboda11 created this revision.
jansvoboda11 added reviewers: benlangmuir, Bigcheese.
Herald added a subscriber: ributzka.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
There are situations where we might encounter redefinition of a module that's not top-level. This patch ensures these can be skipped too when certain criteria are met.
Depends on D150478 <https://reviews.llvm.org/D150478>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D150479
Files:
clang/lib/Lex/ModuleMap.cpp
clang/test/ClangScanDeps/modules-private-framework-submodule.c
Index: clang/test/ClangScanDeps/modules-private-framework-submodule.c
===================================================================
--- clang/test/ClangScanDeps/modules-private-framework-submodule.c
+++ clang/test/ClangScanDeps/modules-private-framework-submodule.c
@@ -9,7 +9,7 @@
//--- 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" }
+explicit module FW2.Private { header "FW2_Private.h" }
//--- frameworks2/FW2.framework/Headers/FW2.h
//--- frameworks2/FW2.framework/PrivateHeaders/FW2_Private.h
@@ -40,7 +40,7 @@
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "context-hash": "{{.*}}",
-// CHECK-NEXT: "module-name": "FW2_Private"
+// CHECK-NEXT: "module-name": "FW2"
// CHECK-NEXT: }
// CHECK-NEXT: ],
// CHECK: "file-deps": [
Index: clang/lib/Lex/ModuleMap.cpp
===================================================================
--- clang/lib/Lex/ModuleMap.cpp
+++ clang/lib/Lex/ModuleMap.cpp
@@ -2048,7 +2048,7 @@
Map.LangOpts.CurrentModule == ModuleName &&
SourceMgr.getDecomposedLoc(ModuleNameLoc).first !=
SourceMgr.getDecomposedLoc(Existing->DefinitionLoc).first;
- if (!ActiveModule && (LoadedFromASTFile || Inferred || ParsedAsMainInput)) {
+ if (LoadedFromASTFile || Inferred || ParsedAsMainInput) {
// Skip the module definition.
skipUntil(MMToken::RBrace);
if (Tok.is(MMToken::RBrace))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150479.521783.patch
Type: text/x-patch
Size: 1650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230512/2e8f1648/attachment.bin>
More information about the cfe-commits
mailing list