Use has_value instead of hasValue (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 23 Jul 2022 06:04:38 +0000 (23:04 -0700)
committerKazu Hirata <kazu@google.com>
Sat, 23 Jul 2022 06:04:38 +0000 (23:04 -0700)
llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp
mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp

index 844ecdd..458a58c 100644 (file)
@@ -150,9 +150,9 @@ protected:
         TextAddressRanges.getRangeThatContains(LowPC);
 
     if (HighPC)
-      return Range.hasValue() && Range->end() >= *HighPC;
+      return Range.has_value() && Range->end() >= *HighPC;
 
-    return Range.hasValue();
+    return Range.has_value();
   }
 
   uint64_t isBFDDeadAddressRange(uint64_t LowPC, Optional<uint64_t> HighPC,
index efec55c..d3e7258 100644 (file)
@@ -2054,7 +2054,7 @@ void arith::DelinearizeIndexOp::build(OpBuilder &builder,
   SmallVector<Value> basisValues =
       llvm::to_vector(llvm::map_range(basis, [&](OpFoldResult ofr) -> Value {
         Optional<int64_t> staticDim = getConstantIntValue(ofr);
-        if (staticDim.hasValue())
+        if (staticDim.has_value())
           return builder.create<arith::ConstantIndexOp>(result.location,
                                                         *staticDim);
         return ofr.dyn_cast<Value>();
index 7590633..94d789c 100644 (file)
@@ -434,7 +434,7 @@ DiagnosedSilenceableFailure
 transform::MatchOp::apply(transform::TransformResults &results,
                           transform::TransformState &state) {
   llvm::StringSet<> strs;
-  if (getOps().hasValue())
+  if (getOps().has_value())
     strs.insert(getOps()->getAsValueRange<StringAttr>().begin(),
                 getOps()->getAsValueRange<StringAttr>().end());
 
@@ -445,12 +445,12 @@ transform::MatchOp::apply(transform::TransformResults &results,
 
   SmallVector<Operation *> res;
   auto matchFun = [&](Operation *op) {
-    if (getOps().hasValue() && !strs.contains(op->getName().getStringRef()))
+    if (getOps().has_value() && !strs.contains(op->getName().getStringRef()))
       return WalkResult::advance();
 
     // Interfaces cannot be matched by name, just by ID.
     // So we specifically encode the interfaces we care about for this op.
-    if (getInterface().hasValue()) {
+    if (getInterface().has_value()) {
       auto iface = getInterface().getValue();
       if (iface == transform::MatchInterfaceEnum::LinalgOp &&
           !isa<linalg::LinalgOp>(op))
@@ -460,7 +460,7 @@ transform::MatchOp::apply(transform::TransformResults &results,
         return WalkResult::advance();
     }
 
-    if (getAttribute().hasValue() && !op->hasAttr(getAttribute().getValue()))
+    if (getAttribute().has_value() && !op->hasAttr(getAttribute().getValue()))
       return WalkResult::advance();
 
     // All constraints are satisfied.
index 1dfaf69..98d5393 100644 (file)
@@ -280,7 +280,7 @@ static FailureOr<ForeachThreadTilingResult> tileToForeachThreadOpImpl(
     // Symbolic fixed max size per thread.
     // TODO: floor + 0/1 depending on case for better load-balancing.
     OpFoldResult tileSizePerThread =
-        nominalTileSizes.hasValue()
+        nominalTileSizes.has_value()
             ? (*nominalTileSizes)[loopIdx]
             : makeComposedFoldedAffineApply(
                   b, loc, M.ceilDiv(N),