[clang] Basic, Sema: introduce `__attribute__((__personality__(...)))` (PR #185225)
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 9 11:49:15 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),
----------------
compnerd wrote:
Ah, that is fair. I don't think that it matters on most targets. The only target that comes to mind where this matters is WASM, where I don't know if this would be as useful. In fact, I'm not sure what happens there right now - we treat all of the personality routines as the type that I'm using here - `int (*)(...);`.
The information is only used to generate the `eh_frame` or SEH entry, which needs a nominal reference to the personality routine rather than forming an actual call. The calls are runtime only done through the indirect function call.
https://github.com/llvm/llvm-project/pull/185225
More information about the cfe-commits
mailing list