Skip to content

[mlir] Deprecate NamedAttrList(std::nullopt_t) (NFC) #149544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mlir/include/mlir/IR/OperationSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ class NamedAttrList {
using size_type = size_t;

NamedAttrList() : dictionarySorted({}, true) {}
LLVM_DEPRECATED("Use NamedAttrList() instead", "NamedAttrList()")
NamedAttrList(std::nullopt_t none) : NamedAttrList() {}
NamedAttrList(ArrayRef<NamedAttribute> attributes);
NamedAttrList(DictionaryAttr attributes);
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/AsmParser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,8 @@ Value OperationParser::createForwardRefPlaceholder(SMLoc loc, Type type) {
auto name = OperationName("builtin.unrealized_conversion_cast", getContext());
auto *op = Operation::create(
getEncodedSourceLocation(loc), name, type, /*operands=*/{},
/*attributes=*/std::nullopt, /*properties=*/nullptr, /*successors=*/{},
/*numRegions=*/0);
/*attributes=*/NamedAttrList(), /*properties=*/nullptr,
/*successors=*/{}, /*numRegions=*/0);
forwardRefPlaceholders[op->getResult(0)] = loc;
forwardRefOps.insert(op);
return op->getResult(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static Operation *createOp(MLIRContext *context, Location loc,
unsigned int numRegions = 0) {
context->allowUnregisteredDialects();
return Operation::create(loc, OperationName(operationName, context), {}, {},
std::nullopt, OpaqueProperties(nullptr), {},
NamedAttrList(), OpaqueProperties(nullptr), {},
numRegions);
}

Expand Down
4 changes: 2 additions & 2 deletions mlir/unittests/IR/OperationSupportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static Operation *createOp(MLIRContext *context, ArrayRef<Value> operands = {},
context->allowUnregisteredDialects();
return Operation::create(UnknownLoc::get(context),
OperationName("foo.bar", context), resultTypes,
operands, std::nullopt, nullptr, {}, numRegions);
operands, NamedAttrList(), nullptr, {}, numRegions);
}

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

std::string str;
OpPrintingFlags flags;
Expand Down
2 changes: 1 addition & 1 deletion mlir/unittests/IR/ValueTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static Operation *createOp(MLIRContext *context, ArrayRef<Value> operands = {},
context->allowUnregisteredDialects();
return Operation::create(UnknownLoc::get(context),
OperationName("foo.bar", context), resultTypes,
operands, std::nullopt, nullptr, {}, numRegions);
operands, NamedAttrList(), nullptr, {}, numRegions);
}

namespace {
Expand Down
2 changes: 1 addition & 1 deletion mlir/unittests/Transforms/DialectConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static Operation *createOp(MLIRContext *context) {
context->allowUnregisteredDialects();
return Operation::create(UnknownLoc::get(context),
OperationName("foo.bar", context), {}, {},
std::nullopt, /*properties=*/nullptr, {}, 0);
NamedAttrList(), /*properties=*/nullptr, {}, 0);
}

namespace {
Expand Down
Loading