From: Kazu Hirata Date: Sun, 4 Dec 2022 03:08:01 +0000 (-0800) Subject: [flang/unittests] Use std::nullopt instead of None (NFC) X-Git-Tag: upstream/17.0.6~25415 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63b63c3dcd540c4182f1856b5570c7201cc4b3a9;p=platform%2Fupstream%2Fllvm.git [flang/unittests] Use std::nullopt instead of None (NFC) This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 --- diff --git a/flang/unittests/Optimizer/Builder/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/CharacterTest.cpp index 347ec78e8fec..21230ae39963 100644 --- a/flang/unittests/Optimizer/Builder/CharacterTest.cpp +++ b/flang/unittests/Optimizer/Builder/CharacterTest.cpp @@ -28,7 +28,7 @@ public: // Set the insertion point in the function entry block. mlir::ModuleOp mod = builder.create(loc); mlir::func::FuncOp func = mlir::func::FuncOp::create( - loc, "func1", builder.getFunctionType(llvm::None, llvm::None)); + loc, "func1", builder.getFunctionType(std::nullopt, std::nullopt)); auto *entryBlock = func.addEntryBlock(); mod.push_back(mod); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/Builder/ComplexTest.cpp b/flang/unittests/Optimizer/Builder/ComplexTest.cpp index 17a6307e6008..4b895ee7d9e2 100644 --- a/flang/unittests/Optimizer/Builder/ComplexTest.cpp +++ b/flang/unittests/Optimizer/Builder/ComplexTest.cpp @@ -24,7 +24,7 @@ public: // Set the insertion point in the function entry block. mlir::ModuleOp mod = builder.create(loc); mlir::func::FuncOp func = mlir::func::FuncOp::create( - loc, "func1", builder.getFunctionType(llvm::None, llvm::None)); + loc, "func1", builder.getFunctionType(std::nullopt, std::nullopt)); auto *entryBlock = func.addEntryBlock(); mod.push_back(mod); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp index 9defe496b9c0..3dedf3d75c5c 100644 --- a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp +++ b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp @@ -28,7 +28,7 @@ public: // Set the insertion point in the function entry block. mlir::ModuleOp mod = builder.create(loc); mlir::func::FuncOp func = mlir::func::FuncOp::create( - loc, "func1", builder.getFunctionType(llvm::None, llvm::None)); + loc, "func1", builder.getFunctionType(std::nullopt, std::nullopt)); auto *entryBlock = func.addEntryBlock(); mod.push_back(mod); builder.setInsertionPointToStart(entryBlock); @@ -176,7 +176,7 @@ TEST_F(FIRBuilderTest, getNamedFunction) { EXPECT_EQ(nullptr, func2); auto loc = builder.getUnknownLoc(); func2 = builder.createFunction( - loc, "func2", builder.getFunctionType(llvm::None, llvm::None)); + loc, "func2", builder.getFunctionType(std::nullopt, std::nullopt)); auto func2query = builder.getNamedFunction("func2"); EXPECT_EQ(func2, func2query); } diff --git a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp index 22d580feda72..429f75a1e1a1 100644 --- a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp +++ b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp @@ -27,7 +27,7 @@ public: // Set the insertion point in the function entry block. mlir::ModuleOp mod = builder.create(loc); mlir::func::FuncOp func = mlir::func::FuncOp::create( - loc, "func1", builder.getFunctionType(llvm::None, llvm::None)); + loc, "func1", builder.getFunctionType(std::nullopt, std::nullopt)); auto *entryBlock = func.addEntryBlock(); mod.push_back(mod); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h b/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h index 6b387eca9b98..0e1c0f4cb60e 100644 --- a/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h +++ b/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h @@ -27,7 +27,7 @@ public: mlir::ModuleOp mod = builder.create(loc); mlir::func::FuncOp func = mlir::func::FuncOp::create(loc, "runtime_unit_tests_func", - builder.getFunctionType(llvm::None, llvm::None)); + builder.getFunctionType(std::nullopt, std::nullopt)); auto *entryBlock = func.addEntryBlock(); mod.push_back(mod); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/FortranVariableTest.cpp b/flang/unittests/Optimizer/FortranVariableTest.cpp index ed248fc72b0a..45262239d616 100644 --- a/flang/unittests/Optimizer/FortranVariableTest.cpp +++ b/flang/unittests/Optimizer/FortranVariableTest.cpp @@ -22,7 +22,7 @@ public: mlir::ModuleOp mod = builder->create(loc); mlir::func::FuncOp func = mlir::func::FuncOp::create(loc, "fortran_variable_tests", - builder->getFunctionType(llvm::None, llvm::None)); + builder->getFunctionType(std::nullopt, std::nullopt)); auto *entryBlock = func.addEntryBlock(); mod.push_back(mod); builder->setInsertionPointToStart(entryBlock); @@ -49,7 +49,7 @@ TEST_F(FortranVariableTest, SimpleScalar) { mlir::Value addr = builder->create(loc, eleType); auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, - /*shape=*/mlir::Value{}, /*typeParams=*/llvm::None, name, + /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt, name, /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}); fir::FortranVariableOpInterface fortranVariable = declare; @@ -100,11 +100,11 @@ TEST_F(FortranVariableTest, SimpleArray) { extents.size(), fir::SequenceType::getUnknownExtent()); mlir::Type seqTy = fir::SequenceType::get(typeShape, eleType); mlir::Value addr = builder->create( - loc, seqTy, /*pinned=*/false, /*typeParams=*/llvm::None, extents); + loc, seqTy, /*pinned=*/false, /*typeParams=*/std::nullopt, extents); mlir::Value shape = createShape(extents); auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, - shape, /*typeParams*/ llvm::None, name, + shape, /*typeParams*/ std::nullopt, name, /*fortran_attrs=*/fir::FortranVariableFlagsAttr{}); fir::FortranVariableOpInterface fortranVariable = declare;