================ @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits