Skip to content

Commit c98b05b

Browse files
[mlir] Deprecate NamedAttrList(std::nullopt_t) (NFC) (#149544)
This patch deprecates NamedAttrList(std::nullopt_t) to avoid use of std::nullopt outside the context of std::optional.
1 parent 36c78ec commit c98b05b

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

mlir/include/mlir/IR/OperationSupport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ class NamedAttrList {
802802
using size_type = size_t;
803803

804804
NamedAttrList() : dictionarySorted({}, true) {}
805+
LLVM_DEPRECATED("Use NamedAttrList() instead", "NamedAttrList()")
805806
NamedAttrList(std::nullopt_t none) : NamedAttrList() {}
806807
NamedAttrList(ArrayRef<NamedAttribute> attributes);
807808
NamedAttrList(DictionaryAttr attributes);

mlir/lib/AsmParser/Parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,8 +1198,8 @@ Value OperationParser::createForwardRefPlaceholder(SMLoc loc, Type type) {
11981198
auto name = OperationName("builtin.unrealized_conversion_cast", getContext());
11991199
auto *op = Operation::create(
12001200
getEncodedSourceLocation(loc), name, type, /*operands=*/{},
1201-
/*attributes=*/std::nullopt, /*properties=*/nullptr, /*successors=*/{},
1202-
/*numRegions=*/0);
1201+
/*attributes=*/NamedAttrList(), /*properties=*/nullptr,
1202+
/*successors=*/{}, /*numRegions=*/0);
12031203
forwardRefPlaceholders[op->getResult(0)] = loc;
12041204
forwardRefOps.insert(op);
12051205
return op->getResult(0);

mlir/unittests/Debug/FileLineColLocBreakpointManagerTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static Operation *createOp(MLIRContext *context, Location loc,
2424
unsigned int numRegions = 0) {
2525
context->allowUnregisteredDialects();
2626
return Operation::create(loc, OperationName(operationName, context), {}, {},
27-
std::nullopt, OpaqueProperties(nullptr), {},
27+
NamedAttrList(), OpaqueProperties(nullptr), {},
2828
numRegions);
2929
}
3030

mlir/unittests/IR/OperationSupportTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static Operation *createOp(MLIRContext *context, ArrayRef<Value> operands = {},
2424
context->allowUnregisteredDialects();
2525
return Operation::create(UnknownLoc::get(context),
2626
OperationName("foo.bar", context), resultTypes,
27-
operands, std::nullopt, nullptr, {}, numRegions);
27+
operands, NamedAttrList(), nullptr, {}, numRegions);
2828
}
2929

3030
namespace {
@@ -236,7 +236,7 @@ TEST(OperationFormatPrintTest, CanPrintNameAsPrefix) {
236236
Operation *op = Operation::create(
237237
NameLoc::get(StringAttr::get(&context, "my_named_loc")),
238238
OperationName("t.op", &context), builder.getIntegerType(16), {},
239-
std::nullopt, nullptr, {}, 0);
239+
NamedAttrList(), nullptr, {}, 0);
240240

241241
std::string str;
242242
OpPrintingFlags flags;

mlir/unittests/IR/ValueTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static Operation *createOp(MLIRContext *context, ArrayRef<Value> operands = {},
2222
context->allowUnregisteredDialects();
2323
return Operation::create(UnknownLoc::get(context),
2424
OperationName("foo.bar", context), resultTypes,
25-
operands, std::nullopt, nullptr, {}, numRegions);
25+
operands, NamedAttrList(), nullptr, {}, numRegions);
2626
}
2727

2828
namespace {

mlir/unittests/Transforms/DialectConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static Operation *createOp(MLIRContext *context) {
1515
context->allowUnregisteredDialects();
1616
return Operation::create(UnknownLoc::get(context),
1717
OperationName("foo.bar", context), {}, {},
18-
std::nullopt, /*properties=*/nullptr, {}, 0);
18+
NamedAttrList(), /*properties=*/nullptr, {}, 0);
1919
}
2020

2121
namespace {

0 commit comments

Comments
 (0)