]> granicus.if.org Git - clang/commitdiff
Inferred framework modules automatically export anything they import
authorDouglas Gregor <dgregor@apple.com>
Mon, 5 Dec 2011 17:40:25 +0000 (17:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 5 Dec 2011 17:40:25 +0000 (17:40 +0000)
(i.e., 'export *'), to better match the semantics of headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145813 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/ModuleMap.cpp
test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h [new file with mode: 0644]
test/Modules/auto-module-import.c

index 02848eef6d44d8a8c7f878d028b9d43aeb0df661..6d227d003e9d5aabd6f35f887f36b6df11f003b9 100644 (file)
@@ -197,9 +197,14 @@ ModuleMap::inferFrameworkModule(StringRef ModuleName,
   
   Module *Result = new Module(ModuleName, SourceLocation(), 
                               /*IsFramework=*/true);
+  // umbrella "umbrella-header-name"
   Result->UmbrellaHeader = UmbrellaHeader;
   Headers[UmbrellaHeader] = Result;
   UmbrellaDirs[FrameworkDir] = Result;
+  
+  // export *
+  Result->Exports.push_back(Module::ExportDecl(0, true));
+  
   Modules[ModuleName] = Result;
   return Result;
 }
diff --git a/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h b/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h
new file mode 100644 (file)
index 0000000..1417e0c
--- /dev/null
@@ -0,0 +1,2 @@
+#import <Module/Module.h> // expected-warning{{treating #import as an import of module 'Module'}}
+
index 1b5ef9959015ba98395049a7d68515351dd65a61..cebfbc6d29f6f69514b8235ae5cdcb333e11d066 100644 (file)
@@ -12,3 +12,8 @@
 #  error DEPENDS_ON_MODULE should have been hidden
 #endif
 
+Module *mod; // expected-error{{unknown type name 'Module'}}
+
+#import <AlsoDependsOnModule/AlsoDependsOnModule.h> // expected-warning{{treating #import as an import of module 'AlsoDependsOnModule'}}
+Module *mod2;
+