[Mlir-commits] [mlir] 1b1cfe4 - [mlir] Set intial value for integer FieldParser function

Mahesh Ravishankar llvmlistbot at llvm.org
Fri Aug 4 14:38:53 PDT 2023


Author: CindyLiu
Date: 2023-08-04T21:38:42Z
New Revision: 1b1cfe4311dceb0cda6452f3d549ac4d0af1eeff

URL: https://github.com/llvm/llvm-project/commit/1b1cfe4311dceb0cda6452f3d549ac4d0af1eeff
DIFF: https://github.com/llvm/llvm-project/commit/1b1cfe4311dceb0cda6452f3d549ac4d0af1eeff.diff

LOG: [mlir] Set intial value for integer FieldParser function

GCC complains FieldParser returns the value that does not have an
obvious initial value. Set an initial return value for the FieldParser
function.

The change is a no-op functionality-wise. The return value should be
updated within the function.

This should fix https://github.com/llvm/llvm-project/issues/64312

Differential Revision: https://reviews.llvm.org/D156848

Added: 
    

Modified: 
    mlir/include/mlir/IR/DialectImplementation.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/DialectImplementation.h b/mlir/include/mlir/IR/DialectImplementation.h
index f045e1017ea8a0..1e4f7f787a1eef 100644
--- a/mlir/include/mlir/IR/DialectImplementation.h
+++ b/mlir/include/mlir/IR/DialectImplementation.h
@@ -87,7 +87,7 @@ template <typename IntT>
 struct FieldParser<IntT,
                    std::enable_if_t<std::is_integral<IntT>::value, IntT>> {
   static FailureOr<IntT> parse(AsmParser &parser) {
-    IntT value;
+    IntT value = 0;
     if (parser.parseInteger(value))
       return failure();
     return value;


        


More information about the Mlir-commits mailing list