summaryrefslogtreecommitdiff
path: root/mlir/test/lib/Dialect/Test/TestAttributes.cpp
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2021-09-30 05:01:17 +0000
committerMehdi Amini <joker.eph@gmail.com>2021-09-30 05:01:17 +0000
commit3310e0020cf1bc4c17acf9d404274325007af326 (patch)
tree9bf5a8e31f90c14601678f678bcc1778860df30a /mlir/test/lib/Dialect/Test/TestAttributes.cpp
parent4b32f8bac40dcd1535bfe95757c3de0911bf6d1a (diff)
Revert "[ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser."
This reverts commit 4b32f8bac40dcd1535bfe95757c3de0911bf6d1a. Seems like the build is broken with -DDBUILD_SHARED_LIBS=ON
Diffstat (limited to 'mlir/test/lib/Dialect/Test/TestAttributes.cpp')
-rw-r--r--mlir/test/lib/Dialect/Test/TestAttributes.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
index 29b702323856..3cc2c81fee48 100644
--- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
@@ -27,12 +27,13 @@ using namespace test;
// AttrWithSelfTypeParamAttr
//===----------------------------------------------------------------------===//
-Attribute AttrWithSelfTypeParamAttr::parse(DialectAsmParser &parser,
+Attribute AttrWithSelfTypeParamAttr::parse(MLIRContext *context,
+ DialectAsmParser &parser,
Type type) {
Type selfType;
if (parser.parseType(selfType))
return Attribute();
- return get(parser.getContext(), selfType);
+ return get(context, selfType);
}
void AttrWithSelfTypeParamAttr::print(DialectAsmPrinter &printer) const {
@@ -43,11 +44,12 @@ void AttrWithSelfTypeParamAttr::print(DialectAsmPrinter &printer) const {
// AttrWithTypeBuilderAttr
//===----------------------------------------------------------------------===//
-Attribute AttrWithTypeBuilderAttr::parse(DialectAsmParser &parser, Type type) {
+Attribute AttrWithTypeBuilderAttr::parse(MLIRContext *context,
+ DialectAsmParser &parser, Type type) {
IntegerAttr element;
if (parser.parseAttribute(element))
return Attribute();
- return get(parser.getContext(), element);
+ return get(context, element);
}
void AttrWithTypeBuilderAttr::print(DialectAsmPrinter &printer) const {
@@ -58,7 +60,8 @@ void AttrWithTypeBuilderAttr::print(DialectAsmPrinter &printer) const {
// CompoundAAttr
//===----------------------------------------------------------------------===//
-Attribute CompoundAAttr::parse(DialectAsmParser &parser, Type type) {
+Attribute CompoundAAttr::parse(MLIRContext *context, DialectAsmParser &parser,
+ Type type) {
int widthOfSomething;
Type oneType;
SmallVector<int, 4> arrayOfInts;
@@ -76,7 +79,7 @@ Attribute CompoundAAttr::parse(DialectAsmParser &parser, Type type) {
if (parser.parseRSquare() || parser.parseGreater())
return Attribute();
- return get(parser.getContext(), widthOfSomething, oneType, arrayOfInts);
+ return get(context, widthOfSomething, oneType, arrayOfInts);
}
void CompoundAAttr::print(DialectAsmPrinter &printer) const {
@@ -90,7 +93,8 @@ void CompoundAAttr::print(DialectAsmPrinter &printer) const {
// CompoundAAttr
//===----------------------------------------------------------------------===//
-Attribute TestI64ElementsAttr::parse(DialectAsmParser &parser, Type type) {
+Attribute TestI64ElementsAttr::parse(MLIRContext *context,
+ DialectAsmParser &parser, Type type) {
SmallVector<uint64_t> elements;
if (parser.parseLess() || parser.parseLSquare())
return Attribute();
@@ -104,7 +108,7 @@ Attribute TestI64ElementsAttr::parse(DialectAsmParser &parser, Type type) {
if (parser.parseRSquare() || parser.parseGreater())
return Attribute();
return parser.getChecked<TestI64ElementsAttr>(
- parser.getContext(), type.cast<ShapedType>(), elements);
+ context, type.cast<ShapedType>(), elements);
}
void TestI64ElementsAttr::print(DialectAsmPrinter &printer) const {
@@ -154,7 +158,8 @@ Attribute TestDialect::parseAttribute(DialectAsmParser &parser,
return Attribute();
{
Attribute attr;
- auto parseResult = generatedAttributeParser(parser, attrTag, type, attr);
+ auto parseResult =
+ generatedAttributeParser(getContext(), parser, attrTag, type, attr);
if (parseResult.hasValue())
return attr;
}