summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2017-01-11 18:47:38 +0000
committerManman Ren <manman.ren@gmail.com>2017-01-11 18:47:38 +0000
commit9803ee8e9a3af45cdb62e5359929ff608d6dae7d (patch)
tree4293a983724eebfa39371468f2f3beb8128f758c /clang/lib/CodeGen/CodeGenModule.cpp
parent3e9dea024ec6816758314fb6eb58cc5b1678d334 (diff)
downloadbcm5719-llvm-9803ee8e9a3af45cdb62e5359929ff608d6dae7d.tar.gz
bcm5719-llvm-9803ee8e9a3af45cdb62e5359929ff608d6dae7d.zip
Module: Do not add any link flags when an implementation TU of a module imports
a header of that same module. This fixes a regression caused by r280409. rdar://problem/29930553 This is an updated version for r291628 (which was reverted in r291688). llvm-svn: 291689
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index ab29d2dbb56..36005430ae4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1243,9 +1243,15 @@ void CodeGenModule::EmitModuleLinkOptions() {
SmallVector<clang::Module *, 16> 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.
OpenPOWER on IntegriCloud