summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2021-10-21 07:08:18 -0400
committerAaron Ballman <aaron@aaronballman.com>2021-10-21 07:08:18 -0400
commitaad244dfc566236e9d3ef48c7aea3616bb6aab14 (patch)
tree3fdc02b293b66558a0eba6bd2549aff21adb1af5 /clang/lib/CodeGen/CodeGenModule.cpp
parent39724158d38766f7d8683f78f54d80d174cae96a (diff)
Revert "AddGlobalAnnotations for function with or without function body."
This reverts commit 121b2252de0eed68f2ddf5f09e924a6c35423d47. The following code causes a crash in some circumstances: struct k { ~k() __attribute__((annotate(""))) {} }; void m() { k(); }
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e53a8a36974a..74c4490d5422 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2200,9 +2200,6 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
CalleeIdx, PayloadIndices,
/* VarArgsArePassed */ false)}));
}
-
- if (FD->hasAttr<AnnotateAttr>())
- AddGlobalAnnotations(FD, F);
}
void CodeGenModule::addUsedGlobal(llvm::GlobalValue *GV) {
@@ -4900,6 +4897,8 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
AddGlobalCtor(Fn, CA->getPriority());
if (const DestructorAttr *DA = D->getAttr<DestructorAttr>())
AddGlobalDtor(Fn, DA->getPriority(), true);
+ if (D->hasAttr<AnnotateAttr>())
+ AddGlobalAnnotations(D, Fn);
}
void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) {