[clang] [llvm] [mlir] [RFC] [IR] Change personality function type from Constant* to Function* (PR #176952)

Jameson Nash via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 21 12:49:39 PST 2026


vtjnash wrote:

I think, from reading the code, that currently the only way to do that would be to guess at the internal name and then define an alias that prevents the compiler from creating the function using CreateRuntimeFunction call:
```c++
extern "C" {
static void fake__C_specific_handler(...);
static void __C_specific_handler(...) __attribute__((alias("fake__C_specific_handler")));
}
```

To intercept this call:
```c++
static llvm::FunctionCallee getPersonalityFn(CodeGenModule &CGM,
                                             const EHPersonality &Personality) {
  return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty, true),
                                   Personality.PersonalityFn,
                                   llvm::AttributeList(), /*Local=*/true);
}
```

https://github.com/llvm/llvm-project/pull/176952


More information about the cfe-commits mailing list