From 1715a2f9d597735f12b290beb70318c5c009a60c 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. llvm-svn: 172448 --- clang/lib/CodeGen/CodeGenModule.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c435288..4b662e0 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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.1