[clang] [CIR] Upstream minimal builtin function call support (PR #142981)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 11:54:29 PDT 2025
================
@@ -1004,8 +1004,48 @@ static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) {
return cgm.getAddrOfFunction(gd);
}
-static CIRGenCallee emitDirectCallee(CIRGenModule &cgm, GlobalDecl gd) {
- assert(!cir::MissingFeatures::opCallBuiltinFunc());
+// Detect the unusual situation where an inline version is shadowed by a
+// non-inline version. In that case we should pick the external one
+// everywhere. That's GCC behavior too.
+static bool onlyHasInlineBuiltinDeclaration(const FunctionDecl *fd) {
+ for (const FunctionDecl *pd = fd; pd; pd = pd->getPreviousDecl())
+ if (!pd->isInlineBuiltinDeclaration())
+ return false;
+ return true;
+}
+
+CIRGenCallee CIRGenFunction::emitDirectCallee(const GlobalDecl &gd) {
+ const auto *fd = cast<FunctionDecl>(gd.getDecl());
+
+ if (unsigned builtinID = fd->getBuiltinID()) {
+ std::string noBuiltinFD = ("no-builtin-" + fd->getName()).str();
----------------
erichkeane wrote:
What is this for? And the line below?
https://github.com/llvm/llvm-project/pull/142981
More information about the cfe-commits
mailing list