diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2020-10-26 11:25:23 -0700 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2020-10-26 11:37:55 -0700 |
commit | c8f84bd0947d770a5df5e15d568a25a4f190df0b (patch) | |
tree | 8edfba69d76c217c6c4727bd7a9412e23d931459 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | b888463f8d6b1a0b003fa329c28e7348356787b5 (diff) | |
download | llvm-c8f84bd0947d770a5df5e15d568a25a4f190df0b.zip llvm-c8f84bd0947d770a5df5e15d568a25a4f190df0b.tar.gz llvm-c8f84bd0947d770a5df5e15d568a25a4f190df0b.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index fd13321..2a7fb4f 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<VarDecl>(GD.getDecl()), - D->getType().isConstQualified()); + if (const auto *VD = dyn_cast<VarDecl>(GD.getDecl())) + LT = getLLVMLinkageVarDefinition(VD, D->getType().isConstQualified()); + else + LT = getFunctionLinkage(GD); } // Create the new alias itself, but don't set a name yet. |