[Lldb-commits] [lldb] 1ca496b - Remove redundant initialization of std::optional (NFC)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 16 00:40:12 PDT 2023


Author: Kazu Hirata
Date: 2023-04-16T00:40:05-07:00
New Revision: 1ca496bd611591193432aee2d913a4db3618db45

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

LOG: Remove redundant initialization of std::optional (NFC)

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    llvm/include/llvm/Transforms/Scalar/JumpThreading.h
    llvm/lib/Transforms/Scalar/SROA.cpp
    mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
    mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
    mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index d685e4df6d85..c0f0cb6c5fd2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -575,7 +575,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon {
   /// no dSYM file is being used, this file index will be set to a
   /// valid value that can be used in DIERef objects which will contain
   /// an index that identifies the .DWO or .o file.
-  std::optional<uint64_t> m_file_index = std::nullopt;
+  std::optional<uint64_t> m_file_index;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H

diff  --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
index e1ff43a6093c..3364d7eaee42 100644
--- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
+++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
@@ -83,8 +83,8 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
   LazyValueInfo *LVI = nullptr;
   AAResults *AA = nullptr;
   std::unique_ptr<DomTreeUpdater> DTU;
-  std::optional<BlockFrequencyInfo *> BFI = std::nullopt;
-  std::optional<BranchProbabilityInfo *> BPI = std::nullopt;
+  std::optional<BlockFrequencyInfo *> BFI;
+  std::optional<BranchProbabilityInfo *> BPI;
   bool ChangedSinceLastAnalysisUpdate = false;
   bool HasGuards = false;
 #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS

diff  --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index a58dcff466e3..d533f8f6191c 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -241,7 +241,7 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
     bool SetKillLocation = false;
 
     if (IsSplit) {
-      std::optional<DIExpression::FragmentInfo> BaseFragment = std::nullopt;
+      std::optional<DIExpression::FragmentInfo> BaseFragment;
       {
         auto R = BaseFragments.find(getAggregateVariable(DbgAssign));
         if (R == BaseFragments.end())

diff  --git a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
index 0c55abccd1bb..b4d070a42d98 100644
--- a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
+++ b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
@@ -77,7 +77,7 @@ class ValueBoundsConstraintSet {
 
     ValueBoundsConstraintSet &cstr;
     Value value;
-    std::optional<int64_t> dim = std::nullopt;
+    std::optional<int64_t> dim;
   };
 
 public:

diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index c593f848a5e3..9595c1851952 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -732,7 +732,7 @@ static bool isTypeCompatibleWithAtomicOp(Type type, bool isPointerTypeAllowed) {
   if (type.isa<LLVMPointerType>())
     return isPointerTypeAllowed;
 
-  std::optional<unsigned> bitWidth = std::nullopt;
+  std::optional<unsigned> bitWidth;
   if (auto floatType = type.dyn_cast<FloatType>()) {
     if (!isCompatibleFloatingPointType(type))
       return false;

diff  --git a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
index 668629ac7451..cc6541e02f9c 100644
--- a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
@@ -77,7 +77,7 @@ struct ForOpInterface
 
     // Check if computed bound equals the corresponding iter_arg.
     Value singleValue = nullptr;
-    std::optional<int64_t> singleDim = std::nullopt;
+    std::optional<int64_t> singleDim;
     if (auto dimExpr = bound.getResult(0).dyn_cast<AffineDimExpr>()) {
       int64_t idx = dimExpr.getPosition();
       singleValue = boundOperands[idx].first;

diff  --git a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
index 0fe1801f629e..9c2baa3d41c2 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
@@ -495,7 +495,7 @@ void transform::TransformState::recordValueHandleInvalidationByOpHandleOne(
 
   for (Operation *ancestor : potentialAncestors) {
     Operation *definingOp;
-    std::optional<unsigned> resultNo = std::nullopt;
+    std::optional<unsigned> resultNo;
     unsigned argumentNo, blockNo, regionNo;
     if (auto opResult = payloadValue.dyn_cast<OpResult>()) {
       definingOp = opResult.getOwner();
@@ -1495,7 +1495,7 @@ LogicalResult transform::detail::verifyTransformOpInterface(Operation *op) {
         });
   };
 
-  std::optional<unsigned> firstConsumedOperand = std::nullopt;
+  std::optional<unsigned> firstConsumedOperand;
   for (OpOperand &operand : op->getOpOperands()) {
     auto range = effectsOn(operand.get());
     if (range.empty()) {


        


More information about the lldb-commits mailing list