[clang] [CIR] Cleanup support for C functions (PR #136854)
Iris Shi via cfe-commits
cfe-commits at lists.llvm.org
Tue May 13 00:30:07 PDT 2025
================
@@ -247,8 +248,21 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd,
"function definition with a non-identifier for a name");
return;
}
- cir::FuncType funcType =
- cast<cir::FuncType>(convertType(funcDecl->getType()));
+
+ 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
----------------
el-ev wrote:
Fixed, thanks.
https://github.com/llvm/llvm-project/pull/136854
More information about the cfe-commits
mailing list