Fix build failures from 4f6477a615.

This commit is contained in:
Leonard Chan 2022-10-05 18:53:54 +00:00
parent c16f3260a9
commit 34004d2d03
2 changed files with 11 additions and 5 deletions

View File

@ -516,6 +516,10 @@ namespace llvm {
bool parseExceptionArgs(SmallVectorImpl<Value *> &Args,
PerFunctionState &PFS);
bool resolveFunctionType(Type *RetType,
const SmallVector<ParamInfo, 16> &ArgList,
FunctionType *&FuncTy);
// Constant Parsing.
bool parseValID(ValID &ID, PerFunctionState *PFS,
Type *ExpectedTy = nullptr);

View File

@ -6417,7 +6417,9 @@ bool LLParser::parseIndirectBr(Instruction *&Inst, PerFunctionState &PFS) {
// If RetType is a non-function pointer type, then this is the short syntax
// for the call, which means that RetType is just the return type. Infer the
// rest of the function argument types from the arguments that are present.
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
bool LLParser::resolveFunctionType(Type *RetType,
const SmallVector<ParamInfo, 16> &ArgList,
FunctionType *&FuncTy) {
FuncTy = dyn_cast<FunctionType>(RetType);
if (!FuncTy) {
// Pull out the types of all of the arguments...
@ -6426,7 +6428,7 @@ static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16>
ParamTypes.push_back(ArgList[i].V->getType());
if (!FunctionType::isValidReturnType(RetType))
return error(RetTypeLoc, "Invalid result type for LLVM function");
return true;
FuncTy = FunctionType::get(RetType, ParamTypes, false);
}
@ -6468,7 +6470,7 @@ bool LLParser::parseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
// rest of the function argument types from the arguments that are present.
FunctionType *Ty;
if (resolveFunctionType(RetType, ArgList, Ty))
return true;
return error(RetTypeLoc, "Invalid result type for LLVM function");
CalleeID.FTy = Ty;
@ -6785,7 +6787,7 @@ bool LLParser::parseCallBr(Instruction *&Inst, PerFunctionState &PFS) {
// rest of the function argument types from the arguments that are present.
FunctionType *Ty;
if (resolveFunctionType(RetType, ArgList, Ty))
return true;
return error(RetTypeLoc, "Invalid result type for LLVM function");
CalleeID.FTy = Ty;
@ -7181,7 +7183,7 @@ bool LLParser::parseCall(Instruction *&Inst, PerFunctionState &PFS,
// rest of the function argument types from the arguments that are present.
FunctionType *Ty;
if (resolveFunctionType(RetType, ArgList, Ty))
return true;
return error(RetTypeLoc, "Invalid result type for LLVM function");
CalleeID.FTy = Ty;