summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2020-09-01 11:52:28 -0400
committerErik Pilkington <erik.pilkington@gmail.com>2020-09-02 12:19:11 -0400
commit8ff44e644bb70dfb8decc397a42679df6e6f8ba1 (patch)
treea647656ac7bc57fb06692b77b7b4a57ff0ddfd22 /clang/lib/CodeGen/CodeGenModule.cpp
parentddd48cdba690fdeefc6ad02a912b63bdb66401b4 (diff)
[IRGen] Fix an assert when __attribute__((used)) is used on an ObjC method
This assert doesn't really make sense for functions in general, since they start life as declarations, and there isn't really any reason to require them to be defined before attributes are applied to them. rdar://67895846
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 77a5079bd0f1..1f362e2b6b31 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1989,7 +1989,7 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
}
void CodeGenModule::addUsedGlobal(llvm::GlobalValue *GV) {
- assert(!GV->isDeclaration() &&
+ assert(isa<llvm::Function>(GV) || !GV->isDeclaration() &&
"Only globals with definition can force usage.");
LLVMUsed.emplace_back(GV);
}