[clang] [CIR] Implement inline builtin functions (PR #163911)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 17 17:16:32 PDT 2025
================
@@ -551,6 +551,50 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn,
const auto funcDecl = cast<FunctionDecl>(gd.getDecl());
curGD = gd;
+ if (funcDecl->isInlineBuiltinDeclaration()) {
+ // When generating code for a builtin with an inline declaration, use a
+ // mangled name to hold the actual body, while keeping an external
+ // declaration in case the function pointer is referenced somewhere.
+ std::string fdInlineName = fn.getName().str() + ".inline";
----------------
andykaylor wrote:
We're using the name from the `FuncOp` here, which may be mangled, but the code above in `emitDirectCallee` is using the name from `FunctionDecl` which I don't think is mangled. The OGCG version of `emitDirectCallee` gets the mangled name.
https://github.com/llvm/llvm-project/pull/163911
More information about the cfe-commits
mailing list