Author: hans Date: Fri Sep 13 01:10:33 2019 New Revision: 371821 URL: http://llvm.org/viewvc/llvm-project?rev=371821&view=rev Log: Merging r371766: ------------------------------------------------------------------------ r371766 | nickdesaulniers | 2019-09-12 21:53:35 +0200 (Thu, 12 Sep 2019) | 29 lines
[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/branches/release_90/ (props changed) cfe/branches/release_90/lib/AST/Decl.cpp cfe/branches/release_90/test/CodeGen/alias.c Propchange: cfe/branches/release_90/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Sep 13 01:10:33 2019 @@ -1,4 +1,4 @@ /cfe/branches/type-system-rewrite:134693-134817 -/cfe/trunk:366429,366447-366448,366457,366474,366480,366483,366511,366670,366694,366699,366878,367008,367039,367055,367103,367134,367301,367305,367323,367387,367403,367520,367530,367661,367675,367802,367823,367906,368104,368202,368552,368561,368874,368940,369043,369093,369251,369641,369705,369713,369749,369760,369829,369834,370035,370073,370850,371027 +/cfe/trunk:366429,366447-366448,366457,366474,366480,366483,366511,366670,366694,366699,366878,367008,367039,367055,367103,367134,367301,367305,367323,367387,367403,367520,367530,367661,367675,367802,367823,367906,368104,368202,368552,368561,368874,368940,369043,369093,369251,369641,369705,369713,369749,369760,369829,369834,370035,370073,370850,371027,371766 /cfe/trunk/test:170344 /cfe/trunk/test/SemaTemplate:126920 Modified: cfe/branches/release_90/lib/AST/Decl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/lib/AST/Decl.cpp?rev=371821&r1=371820&r2=371821&view=diff ============================================================================== --- cfe/branches/release_90/lib/AST/Decl.cpp (original) +++ cfe/branches/release_90/lib/AST/Decl.cpp Fri Sep 13 01:10:33 2019 @@ -3332,7 +3332,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/branches/release_90/test/CodeGen/alias.c URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/test/CodeGen/alias.c?rev=371821&r1=371820&r2=371821&view=diff ============================================================================== --- cfe/branches/release_90/test/CodeGen/alias.c (original) +++ cfe/branches/release_90/test/CodeGen/alias.c Fri Sep 13 01:10:33 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"))); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits