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


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

Reply via email to