From 8ff44e644bb70dfb8decc397a42679df6e6f8ba1 Mon Sep 17 00:00:00 2001 From: Erik Pilkington Date: Tue, 1 Sep 2020 11:52:28 -0400 Subject: [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 --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') 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(GV) || !GV->isDeclaration() && "Only globals with definition can force usage."); LLVMUsed.emplace_back(GV); } -- cgit v1.2.3