aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
authorAndy Kaylor <akaylor@nvidia.com>2025-05-16 09:08:16 -0700
committerGitHub <noreply@github.com>2025-05-16 09:08:16 -0700
commitfa2263b3097c4e5f361505ce564a246a7f289172 (patch)
treebbb82f6046c7ce1b738680bc4a9cf581b1e094b8 /clang/lib/CIR/CodeGen/CIRGenModule.cpp
parent9adcb4fe125e5b2bdf894fb35c7d91e10c10e1ea (diff)
downloadllvm-fa2263b3097c4e5f361505ce564a246a7f289172.zip
llvm-fa2263b3097c4e5f361505ce564a246a7f289172.tar.gz
llvm-fa2263b3097c4e5f361505ce564a246a7f289172.tar.bz2
[CIR][NFC] Use arrangeFunctionDeclaration to build function types (#139787)
This change replaces the simplified call that we were previously using to convert the function type provided by a global declaration to the CIR function type. We now go through 'arrangeGlobalDeclaration' which builds the function type in a more complicated manner. This change has no observable differences for the currently upstreamed CIR support, but it is necessary to prepare for C++ member function calls, which require the extra handling.
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index b4e27bc..bd3aa37 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -249,21 +249,8 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd,
return;
}
- cir::FuncType funcType;
- // TODO: Move this to arrangeFunctionDeclaration when it is
- // implemented.
- // When declaring a function without a prototype, always use a
- // non-variadic type.
- if (CanQual<FunctionNoProtoType> noProto =
- funcDecl->getType()
- ->getCanonicalTypeUnqualified()
- .getAs<FunctionNoProtoType>()) {
- const CIRGenFunctionInfo &fi = getTypes().arrangeCIRFunctionInfo(
- noProto->getReturnType(), {}, RequiredArgs::All);
- funcType = getTypes().getFunctionType(fi);
- } else {
- funcType = cast<cir::FuncType>(convertType(funcDecl->getType()));
- }
+ const CIRGenFunctionInfo &fi = getTypes().arrangeGlobalDeclaration(gd);
+ cir::FuncType funcType = getTypes().getFunctionType(fi);
cir::FuncOp funcOp = dyn_cast_if_present<cir::FuncOp>(op);
if (!funcOp || funcOp.getFunctionType() != funcType) {