Merged to release_90 in r371821.
On Thu, Sep 12, 2019 at 9:51 PM Nick Desaulniers via cfe-commits <cfe-commits@lists.llvm.org> wrote: > > Author: nickdesaulniers > Date: Thu Sep 12 12:53:35 2019 > New Revision: 371766 > > URL: http://llvm.org/viewvc/llvm-project?rev=371766&view=rev > Log: > [Clang][CodeGen] support alias attribute w/ gnu_inline > > Summary: > r369705 did not consider the addition of gnu_inline on function > declarations of alias attributed functions. This resulted in a reported > regression in the clang-9-rc4 release from the Zig developers building > glibc, which was observable as a failed assertion: > > llvm-project/clang/lib/AST/Decl.cpp:3336: bool > clang::FunctionDecl::isInlineDefinitionExternallyVisible() const: > Assertion `(doesThisDeclarationHaveABody() || willHaveBody()) && "Must > be a function definition"' failed. > > Alias function declarations do not have bodies, so allow us to proceed > if we have the alias function attribute but no body/definition, and add > a test case. The emitted symbols and their linkage matches GCC for the > added test case. > > Link: https://bugs.llvm.org/show_bug.cgi?id=43268 > > Reviewers: aaron.ballman, rsmith, erichkeane, andrewrk > > Reviewed By: andrewrk > > Subscribers: cfe-commits, andrewrk, hans, srhines > > Tags: #clang > > Differential Revision: https://reviews.llvm.org/D67455 > > Modified: > cfe/trunk/lib/AST/Decl.cpp > cfe/trunk/test/CodeGen/alias.c > > Modified: cfe/trunk/lib/AST/Decl.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=371766&r1=371765&r2=371766&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/Decl.cpp (original) > +++ cfe/trunk/lib/AST/Decl.cpp Thu Sep 12 12:53:35 2019 > @@ -3348,7 +3348,8 @@ SourceRange FunctionDecl::getExceptionSp > /// an externally visible symbol, but "extern inline" will not create an > /// externally visible symbol. > bool FunctionDecl::isInlineDefinitionExternallyVisible() const { > - assert((doesThisDeclarationHaveABody() || willHaveBody()) && > + assert((doesThisDeclarationHaveABody() || willHaveBody() || > + hasAttr<AliasAttr>()) && > "Must be a function definition"); > assert(isInlined() && "Function must be inline"); > ASTContext &Context = getASTContext(); > > Modified: cfe/trunk/test/CodeGen/alias.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alias.c?rev=371766&r1=371765&r2=371766&view=diff > ============================================================================== > --- cfe/trunk/test/CodeGen/alias.c (original) > +++ cfe/trunk/test/CodeGen/alias.c Thu Sep 12 12:53:35 2019 > @@ -99,3 +99,8 @@ static int test10_foo __attribute__((ali > // CHECKGLOBALS-NOT: @test11_foo = dso_local > void test11(void) {} > static void test11_foo(void) __attribute__((alias("test11"))); > + > +// Test that gnu_inline+alias work. > +// CHECKGLOBALS: @test12_alias = alias void (), void ()* @test12 > +void test12(void) {} > +inline void test12_alias(void) __attribute__((gnu_inline, alias("test12"))); > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits