]> granicus.if.org Git - clang/commitdiff
Allow inferred submodules for any (sub)module that has an umbrella header
authorDouglas Gregor <dgregor@apple.com>
Tue, 6 Dec 2011 17:34:58 +0000 (17:34 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 6 Dec 2011 17:34:58 +0000 (17:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145945 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/ModuleMap.cpp
test/Modules/Inputs/DependsOnModule.framework/module.map
test/Modules/auto-module-import.c

index 5f3379bf965224a93b8154d6b5d9186074f52db3..581a5d5631df27c82a0789f515b370f18b2ba273 100644 (file)
@@ -900,16 +900,16 @@ void ModuleMapParser::parseInferredSubmoduleDecl(bool Explicit) {
   }
   
   // Inferred modules must have umbrella headers.
-  if (!Failed && !ActiveModule->getTopLevelModule()->UmbrellaHeader) {
+  if (!Failed && !ActiveModule->UmbrellaHeader) {
     Diags.Report(StarLoc, diag::err_mmap_inferred_no_umbrella);
     Failed = true;
   }
   
   // Check for redefinition of an inferred module.
-  if (!Failed && ActiveModule->getTopLevelModule()->InferSubmodules) {
+  if (!Failed && ActiveModule->InferSubmodules) {
     Diags.Report(StarLoc, diag::err_mmap_inferred_redef);
-    if (ActiveModule->getTopLevelModule()->InferredSubmoduleLoc.isValid())
-      Diags.Report(ActiveModule->getTopLevelModule()->InferredSubmoduleLoc,
+    if (ActiveModule->InferredSubmoduleLoc.isValid())
+      Diags.Report(ActiveModule->InferredSubmoduleLoc,
                    diag::note_mmap_prev_definition);
     Failed = true;
   }
@@ -927,10 +927,9 @@ void ModuleMapParser::parseInferredSubmoduleDecl(bool Explicit) {
   }
   
   // Note that we have an inferred submodule.
-  Module *TopModule = ActiveModule->getTopLevelModule();
-  TopModule->InferSubmodules = true;
-  TopModule->InferredSubmoduleLoc = StarLoc;
-  TopModule->InferExplicitSubmodules = Explicit;
+  ActiveModule->InferSubmodules = true;
+  ActiveModule->InferredSubmoduleLoc = StarLoc;
+  ActiveModule->InferExplicitSubmodules = Explicit;
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -952,7 +951,7 @@ void ModuleMapParser::parseInferredSubmoduleDecl(bool Explicit) {
     case MMToken::ExportKeyword: {
       consumeToken();
       if (Tok.is(MMToken::Star)) 
-        TopModule->InferExportWildcard = true;
+        ActiveModule->InferExportWildcard = true;
       else
         Diags.Report(Tok.getLocation(), 
                      diag::err_mmap_expected_export_wildcard);
index d77127528544ca973ec44fde46f67b032f386ce8..6bf82b46d3deca8733663a3f04025dfbb74d844e 100644 (file)
@@ -6,5 +6,9 @@ framework module DependsOnModule {
   }
   explicit framework module SubFramework {
     umbrella "SubFramework.h"
+
+    module * {
+      export *
+    }
   }
 }
index 783b53d068d36ede1e30cc673182bc0317768371..4c71f06a841b67745113d1f06a0a353aad013922 100644 (file)
@@ -24,7 +24,7 @@ void testSubframeworkOther() {
 }
 
 // Test header cross-subframework include pattern.
-#include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework'}}
+#include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}}
 
 void testSubframeworkOtherAgain() {
   double *sfo1 = sub_framework_other;