From 3baad29d4413e1409fc69a472d374cf5de1d78ec Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 14 Jan 2013 19:00:05 +0000 Subject: 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 --- lib/CodeGen/CodeGenModule.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') 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; } -- cgit v1.2.3-70-g09d2