[PATCH] D150479: [clang][modules][deps] Allow skipping submodule definitions

2023-05-15 Thread Ben Langmuir via Phabricator via cfe-commits
benlangmuir added inline comments.



Comment at: clang/test/ClangScanDeps/modules-private-framework-submodule.c:43
 // CHECK-NEXT:   "context-hash": "{{.*}}",
-// CHECK-NEXT:   "module-name": "FW2_Private"
+// CHECK-NEXT:   "module-name": "FW2"
 // CHECK-NEXT: }

jansvoboda11 wrote:
> benlangmuir wrote:
> > Does this lose any test coverage for the FW2_Private case?
> This still tests the same general code path, just a more specific case of it. 
> I can keep this test as is and create new one specifically to test the 
> "explicit submodule" case if that makes more sense to you.
Yeah, my preference would be to add a case instead of modifying this one, 
unless there is somewhere else we're already testing the same thing. The exact 
behaviour of FW2.Private vs FW2_Private vs FW2Private is all subtlely different


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150479/new/

https://reviews.llvm.org/D150479

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150479: [clang][modules][deps] Allow skipping submodule definitions

2023-05-15 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added inline comments.



Comment at: clang/test/ClangScanDeps/modules-private-framework-submodule.c:43
 // CHECK-NEXT:   "context-hash": "{{.*}}",
-// CHECK-NEXT:   "module-name": "FW2_Private"
+// CHECK-NEXT:   "module-name": "FW2"
 // CHECK-NEXT: }

benlangmuir wrote:
> Does this lose any test coverage for the FW2_Private case?
This still tests the same general code path, just a more specific case of it. I 
can keep this test as is and create new one specifically to test the "explicit 
submodule" case if that makes more sense to you.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150479/new/

https://reviews.llvm.org/D150479

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150479: [clang][modules][deps] Allow skipping submodule definitions

2023-05-15 Thread Ben Langmuir via Phabricator via cfe-commits
benlangmuir added inline comments.



Comment at: clang/test/ClangScanDeps/modules-private-framework-submodule.c:43
 // CHECK-NEXT:   "context-hash": "{{.*}}",
-// CHECK-NEXT:   "module-name": "FW2_Private"
+// CHECK-NEXT:   "module-name": "FW2"
 // CHECK-NEXT: }

Does this lose any test coverage for the FW2_Private case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150479/new/

https://reviews.llvm.org/D150479

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150479: [clang][modules][deps] Allow skipping submodule definitions

2023-05-12 Thread Jan Svoboda via Phabricator via cfe-commits
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 .


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))


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))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits