[clang] Basic, Sema: introduce `__attribute__((__personality__(...)))` (PR #185225)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 9 10:31:24 PDT 2026
================
@@ -1655,6 +1655,15 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
PGO->verifyCounterMap();
+ if (CurCodeDecl->hasAttr<PersonalityAttr>()) {
+ StringRef Identifier =
+ CurCodeDecl->getAttr<PersonalityAttr>()->getRoutine()->getName();
+ llvm::FunctionCallee PersonalityRoutine =
+ CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty, true),
----------------
erichkeane wrote:
This ends up being kinda problematic if we're creating this as a function, if the function already exists and we don't match function type (particularly if it would be generated after this).
I think we need to do some sort of defense here against someone defining this with what seems like a matching function, and not getting it.
Alternatively, why is this a 'return int' and 'takes variadic', rather than a stricter type? It isn't clear form the documentation that this is what we expect out of a personality, or what we expect it to look like.
https://github.com/llvm/llvm-project/pull/185225
More information about the cfe-commits
mailing list