aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-14 19:00:05 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-14 19:00:05 +0000
commit3baad29d4413e1409fc69a472d374cf5de1d78ec (patch)
tree5015fbe9515d08d78063522296a7335c670b3d34
parentbdc691f1d61765dd806d5ae3b75ae004f676a7c9 (diff)
When forming the link options for an imported module, also include the
link options for the modules it imports. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172448 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CodeGenModule.cpp9
-rw-r--r--test/Modules/Inputs/DependsOnModule.framework/DependsOnModule0
-rw-r--r--test/Modules/autolink.m9
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index c43528866b..4b662e0b89 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -2822,8 +2822,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
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 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
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;
}
diff --git a/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule b/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule
diff --git a/test/Modules/autolink.m b/test/Modules/autolink.m
index 836d910914..9da6d32ec1 100644
--- a/test/Modules/autolink.m
+++ b/test/Modules/autolink.m
@@ -13,9 +13,9 @@ int g() {
return autolink;
}
-@import Module.SubFramework;
-const char *get_module_subframework() {
- return module_subframework;
+@import DependsOnModule.SubFramework;
+float *get_module_subframework() {
+ return sub_framework;
}
@import NoUmbrella;
@@ -23,8 +23,9 @@ int use_no_umbrella() {
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"}