[cfe-commits] r172448 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/Modules/Inputs/DependsOnModule.framework/DependsOnModule test/Modules/autolink.m

Douglas Gregor dgregor at apple.com
Mon Jan 14 11:00:06 PST 2013


Author: dgregor
Date: Mon Jan 14 13:00:05 2013
New Revision: 172448

URL: http://llvm.org/viewvc/llvm-project?rev=172448&view=rev
Log:
When forming the link options for an imported module, also include the
link options for the modules it imports.


Added:
    cfe/trunk/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule
Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/Modules/autolink.m

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=172448&r1=172447&r2=172448&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan 14 13:00:05 2013
@@ -2822,8 +2822,7 @@
         Metadata->addOperand(llvm::MDNode::get(getLLVMContext(), OptString));
       }
 
-      // We've imported this module; now import any of its children that haven't
-      // already been imported.
+      // Import this module's (non-explicit) submodules.
       for (clang::Module::submodule_iterator Sub = Mod->submodule_begin(),
                                           SubEnd = Mod->submodule_end();
            Sub != SubEnd; ++Sub) {
@@ -2833,6 +2832,12 @@
         if (ImportedModules.insert(*Sub))
           Stack.push_back(*Sub);
       }
+
+      // Import this module's dependencies.
+      for (unsigned I = 0, N = Mod->Imports.size(); I != N; ++I) {
+        if (ImportedModules.insert(Mod->Imports[I]))
+          Stack.push_back(Mod->Imports[I]);
+      }
     }
     break;
  }

Added: cfe/trunk/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule?rev=172448&view=auto
==============================================================================
    (empty)

Modified: cfe/trunk/test/Modules/autolink.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/autolink.m?rev=172448&r1=172447&r2=172448&view=diff
==============================================================================
--- cfe/trunk/test/Modules/autolink.m (original)
+++ cfe/trunk/test/Modules/autolink.m Mon Jan 14 13:00:05 2013
@@ -13,9 +13,9 @@
   return autolink;
 }
 
- at import Module.SubFramework;
-const char *get_module_subframework() {
-  return module_subframework;
+ at import DependsOnModule.SubFramework;
+float *get_module_subframework() {
+  return sub_framework;
 }
 
 @import NoUmbrella;
@@ -23,8 +23,9 @@
   return no_umbrella_A;
 }
 
-// CHECK: !llvm.module.linkoptions = !{![[AUTOLINK:[0-9]+]], ![[AUTOLINK_FRAMEWORK:[0-9]+]], ![[MODULE:[0-9]+]], ![[NOUMBRELLA:[0-9]+]]}
+// CHECK: !llvm.module.linkoptions = !{![[AUTOLINK:[0-9]+]], ![[AUTOLINK_FRAMEWORK:[0-9]+]], ![[DEPENDSONMODULE:[0-9]+]], ![[MODULE:[0-9]+]], ![[NOUMBRELLA:[0-9]+]]}
 // CHECK: ![[AUTOLINK]] = metadata !{metadata !"-lautolink"}
 // CHECK: ![[AUTOLINK_FRAMEWORK]] = metadata !{metadata !"-framework", metadata !"autolink_framework"}
+// CHECK: ![[DEPENDSONMODULE]] = metadata !{metadata !"-framework", metadata !"DependsOnModule"}
 // CHECK: ![[MODULE]] = metadata !{metadata !"-framework", metadata !"Module"}
 // CHECK: ![[NOUMBRELLA]] = metadata !{metadata !"-framework", metadata !"NoUmbrella"}





More information about the cfe-commits mailing list