aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2020-10-26 11:25:23 -0700
committerNick Desaulniers <ndesaulniers@google.com>2020-10-26 11:37:55 -0700
commitc8f84bd0947d770a5df5e15d568a25a4f190df0b (patch)
tree8edfba69d76c217c6c4727bd7a9412e23d931459 /clang/lib/CodeGen/CodeGenModule.cpp
parentb888463f8d6b1a0b003fa329c28e7348356787b5 (diff)
downloadllvm-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.cpp6
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.