From d2e0a8dd949ab874c6d66f97106bd5c270e2fa7d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 14 Jan 2017 15:38:35 +0000 Subject: Vendor import of clang release_40 branch r292009: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292009 --- lib/CodeGen/CodeGenModule.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index ab29d2dbb566..36005430ae4c 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1243,9 +1243,15 @@ void CodeGenModule::EmitModuleLinkOptions() { SmallVector Stack; // Seed the stack with imported modules. - for (Module *M : ImportedModules) + for (Module *M : ImportedModules) { + // Do not add any link flags when an implementation TU of a module imports + // a header of that same module. + if (M->getTopLevelModuleName() == getLangOpts().CurrentModule && + !getLangOpts().isCompilingModule()) + continue; if (Visited.insert(M).second) Stack.push_back(M); + } // Find all of the modules to import, making a little effort to prune // non-leaf modules. -- cgit v1.2.3