From c8f84bd0947d770a5df5e15d568a25a4f190df0b Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Mon, 26 Oct 2020 11:25:23 -0700 Subject: [Clang][CodeGen] fix failed assertion Ensure we can emit symbol aliases via function attribute even when function signatures contain incomplete types. Via bugreport: https://reviews.llvm.org/D66492#2350947 Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D90073 --- clang/lib/CodeGen/CodeGenModule.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index fd13321b777e..2a7fb4ff88ac 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -4684,8 +4684,10 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) { Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(), llvm::PointerType::getUnqual(DeclTy), /*D=*/nullptr); - LT = getLLVMLinkageVarDefinition(cast(GD.getDecl()), - D->getType().isConstQualified()); + if (const auto *VD = dyn_cast(GD.getDecl())) + LT = getLLVMLinkageVarDefinition(VD, D->getType().isConstQualified()); + else + LT = getFunctionLinkage(GD); } // Create the new alias itself, but don't set a name yet. -- cgit v1.2.3