Thank you! On 11 January 2017 at 10:47, Manman Ren via cfe-commits < cfe-commits@lists.llvm.org> wrote:
> Author: mren > Date: Wed Jan 11 12:47:38 2017 > New Revision: 291689 > > URL: http://llvm.org/viewvc/llvm-project?rev=291689&view=rev > Log: > 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). > > Added: > cfe/trunk/test/Modules/Inputs/module-impl-with-link/ > cfe/trunk/test/Modules/Inputs/module-impl-with-link/foo.h > cfe/trunk/test/Modules/Inputs/module-impl-with-link/module.modulemap > cfe/trunk/test/Modules/module-impl-with-link.c > Modified: > cfe/trunk/lib/CodeGen/CodeGenModule.cpp > > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ > CodeGenModule.cpp?rev=291689&r1=291688&r2=291689&view=diff > ============================================================ > ================== > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Jan 11 12:47:38 2017 > @@ -1243,9 +1243,15 @@ void CodeGenModule::EmitModuleLinkOption > 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. > > Added: cfe/trunk/test/Modules/Inputs/module-impl-with-link/foo.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > Modules/Inputs/module-impl-with-link/foo.h?rev=291689&view=auto > ============================================================ > ================== > --- cfe/trunk/test/Modules/Inputs/module-impl-with-link/foo.h (added) > +++ cfe/trunk/test/Modules/Inputs/module-impl-with-link/foo.h Wed Jan 11 > 12:47:38 2017 > @@ -0,0 +1 @@ > +//empty > > Added: cfe/trunk/test/Modules/Inputs/module-impl-with-link/module. > modulemap > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > Modules/Inputs/module-impl-with-link/module.modulemap?rev=291689&view=auto > ============================================================ > ================== > --- cfe/trunk/test/Modules/Inputs/module-impl-with-link/module.modulemap > (added) > +++ cfe/trunk/test/Modules/Inputs/module-impl-with-link/module.modulemap > Wed Jan 11 12:47:38 2017 > @@ -0,0 +1,4 @@ > +module Clib { > + header "foo.h" > + link "Clib" > +} > > Added: cfe/trunk/test/Modules/module-impl-with-link.c > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > Modules/module-impl-with-link.c?rev=291689&view=auto > ============================================================ > ================== > --- cfe/trunk/test/Modules/module-impl-with-link.c (added) > +++ cfe/trunk/test/Modules/module-impl-with-link.c Wed Jan 11 12:47:38 > 2017 > @@ -0,0 +1,7 @@ > +// RUN: rm -rf %t > +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules > -fimplicit-module-maps -fmodule-name=Clib %s -I > %S/Inputs/module-impl-with-link > -emit-llvm -o - > +#include "foo.h" > +// CHECK: !{{[0-9]+}} = !{i32 6, !"Linker Options", > ![[LINK_OPTIONS:[0-9]+]]} > +// Make sure we don't generate linker option for module Clib since this > TU is > +// an implementation of Clib. > +// CHECK: ![[LINK_OPTIONS]] = !{} > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits