diff options
author | Manman Ren <manman.ren@gmail.com> | 2017-01-11 18:47:38 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2017-01-11 18:47:38 +0000 |
commit | 9803ee8e9a3af45cdb62e5359929ff608d6dae7d (patch) | |
tree | 4293a983724eebfa39371468f2f3beb8128f758c /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 3e9dea024ec6816758314fb6eb58cc5b1678d334 (diff) | |
download | bcm5719-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.cpp | 8 |
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. |