From: Tres Popp Date: Tue, 5 Jan 2021 23:39:04 +0000 (+0100) Subject: [mlir] Fully specify removeAttr return type X-Git-Tag: llvmorg-13-init~2028 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cbda2cba4f8e4d236d56158cecfb008e03341a70;p=platform%2Fupstream%2Fllvm.git [mlir] Fully specify removeAttr return type This was added without full specification like other generated methods. This then leads to other downstream dialects failing to compile the generated code when they are not in the mlir namespace. Differential Revision: https://reviews.llvm.org/D94132 --- diff --git a/mlir/test/mlir-tblgen/op-attribute.td b/mlir/test/mlir-tblgen/op-attribute.td index b4c193c..2f1d440 100644 --- a/mlir/test/mlir-tblgen/op-attribute.td +++ b/mlir/test/mlir-tblgen/op-attribute.td @@ -80,7 +80,7 @@ def AOp : NS_Op<"a_op", []> { // Test remove methods // --- -// DEF: Attribute AOp::removeCAttrAttr() { +// DEF: ::mlir::Attribute AOp::removeCAttrAttr() { // DEF-NEXT: return (*this)->removeAttr("cAttr"); // Test build methods @@ -271,7 +271,7 @@ def UnitAttrOp : NS_Op<"unit_attr_op", []> { // DEF: bool UnitAttrOp::attr() { // DEF: return {{.*}} != nullptr -// DEF: Attribute UnitAttrOp::removeAttrAttr() { +// DEF: ::mlir::Attribute UnitAttrOp::removeAttrAttr() { // DEF-NEXT: (*this)->removeAttr("attr"); // DEF: build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::UnitAttr attr) @@ -288,7 +288,7 @@ def SomeTypedArrayAttr : TypedArrayAttrBase; def Test_Dialect_2 : Dialect { let name = "dialect_2"; } -def MyStruct : StructAttr<"MyStruct", Test_Dialect_2, +def MyStruct : StructAttr<"MyStruct", Test_Dialect_2, [StructFieldAttr<"potatoes", I64ElementsAttr>]> { let description = "A structure describing a number of potatoes."; } diff --git a/mlir/test/mlir-tblgen/op-decl.td b/mlir/test/mlir-tblgen/op-decl.td index d4d1a8b..3d4d46c 100644 --- a/mlir/test/mlir-tblgen/op-decl.td +++ b/mlir/test/mlir-tblgen/op-decl.td @@ -81,7 +81,7 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> { // CHECK: uint32_t attr1(); // CHECK: ::mlir::FloatAttr attr2Attr() // CHECK: ::llvm::Optional< ::llvm::APFloat > attr2(); -// CHECK: Attribute removeAttr2Attr(); +// CHECK: ::mlir::Attribute removeAttr2Attr(); // CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value val); // CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int integer = 0); // CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::TypeRange s, ::mlir::Value a, ::mlir::ValueRange b, ::mlir::IntegerAttr attr1, /*optional*/::mlir::FloatAttr attr2, unsigned someRegionsCount) diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index 468fd78..b1c8652 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -788,7 +788,7 @@ void OpEmitter::genOptionalAttrRemovers() { auto upperInitial = name.take_front().upper(); auto suffix = name.drop_front(); auto *method = opClass.addMethodAndPrune( - "Attribute", ("remove" + upperInitial + suffix + "Attr").str()); + "::mlir::Attribute", ("remove" + upperInitial + suffix + "Attr").str()); if (!method) return; auto &body = method->body();