[cfe-commits] r145813 - in /cfe/trunk: lib/Lex/ModuleMap.cpp test/Modules/Inputs/AlsoDependsOnModule.framework/ test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/ test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h test/Modules/auto-module-import.c

Douglas Gregor dgregor at apple.com
Mon Dec 5 09:40:25 PST 2011


Author: dgregor
Date: Mon Dec  5 11:40:25 2011
New Revision: 145813

URL: http://llvm.org/viewvc/llvm-project?rev=145813&view=rev
Log:
Inferred framework modules automatically export anything they import
(i.e., 'export *'), to better match the semantics of headers.

Added:
    cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/
    cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/
    cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h
Modified:
    cfe/trunk/lib/Lex/ModuleMap.cpp
    cfe/trunk/test/Modules/auto-module-import.c

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=145813&r1=145812&r2=145813&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Mon Dec  5 11:40:25 2011
@@ -197,9 +197,14 @@
   
   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;
 }

Added: cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h?rev=145813&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h (added)
+++ cfe/trunk/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h Mon Dec  5 11:40:25 2011
@@ -0,0 +1,2 @@
+#import <Module/Module.h> // expected-warning{{treating #import as an import of module 'Module'}}
+

Modified: cfe/trunk/test/Modules/auto-module-import.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/auto-module-import.c?rev=145813&r1=145812&r2=145813&view=diff
==============================================================================
--- cfe/trunk/test/Modules/auto-module-import.c (original)
+++ cfe/trunk/test/Modules/auto-module-import.c Mon Dec  5 11:40:25 2011
@@ -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;
+





More information about the cfe-commits mailing list