[llvm] 34004d2 - Fix build failures from 4f6477a615d18dac6cc3aa0d3fb946191f8168c9.

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 11:54:59 PDT 2022


Author: Leonard Chan
Date: 2022-10-05T18:54:28Z
New Revision: 34004d2d03a9a4908254ebbe5e60b6c99c9425d8

URL: https://github.com/llvm/llvm-project/commit/34004d2d03a9a4908254ebbe5e60b6c99c9425d8
DIFF: https://github.com/llvm/llvm-project/commit/34004d2d03a9a4908254ebbe5e60b6c99c9425d8.diff

LOG: Fix build failures from 4f6477a615d18dac6cc3aa0d3fb946191f8168c9.

Added: 
    

Modified: 
    llvm/include/llvm/AsmParser/LLParser.h
    llvm/lib/AsmParser/LLParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/AsmParser/LLParser.h b/llvm/include/llvm/AsmParser/LLParser.h
index b40b8695223d8..e088002dbb5c1 100644
--- a/llvm/include/llvm/AsmParser/LLParser.h
+++ b/llvm/include/llvm/AsmParser/LLParser.h
@@ -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);

diff  --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 99c369c0ef588..a5081b1db754a 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -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;
 


        


More information about the llvm-commits mailing list