/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|*                                                                            *|
|* AttrDef Definitions                                                        *|
|*                                                                            *|
|* Automatically generated file, do not edit!                                 *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

#ifdef GET_ATTRDEF_LIST
#undef GET_ATTRDEF_LIST

::fir::FortranVariableFlagsAttr,
::fir::FortranProcedureFlagsEnumAttr,
::fir::ReduceAttr,
::fir::LocationKindAttr,
::fir::LocationKindArrayAttr,
::fir::PackArrayHeuristicsAttr,
::fir::OpenACCSafeTempArrayCopyAttr,
::fir::OpenMPSafeTempArrayCopyAttr,
::fir::LocalitySpecifierTypeAttr

#endif  // GET_ATTRDEF_LIST

#ifdef GET_ATTRDEF_CLASSES
#undef GET_ATTRDEF_CLASSES

static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
  return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
    .Case(::fir::FortranVariableFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::FortranVariableFlagsAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Case(::fir::FortranProcedureFlagsEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::FortranProcedureFlagsEnumAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Case(::fir::ReduceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::ReduceAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Case(::fir::LocationKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::LocationKindAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Case(::fir::LocationKindArrayAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::LocationKindArrayAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Case(::fir::PackArrayHeuristicsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::PackArrayHeuristicsAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Case(::fir::OpenACCSafeTempArrayCopyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::OpenACCSafeTempArrayCopyAttr::get(parser.getContext());
      return ::mlir::success(!!value);
    })
    .Case(::fir::OpenMPSafeTempArrayCopyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::OpenMPSafeTempArrayCopyAttr::get(parser.getContext());
      return ::mlir::success(!!value);
    })
    .Case(::fir::LocalitySpecifierTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
      value = ::fir::LocalitySpecifierTypeAttr::parse(parser, type);
      return ::mlir::success(!!value);
    })
    .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
      *mnemonic = keyword;
      return std::nullopt;
    });
}

static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
  return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def)    .Case<::fir::FortranVariableFlagsAttr>([&](auto t) {
      printer << ::fir::FortranVariableFlagsAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Case<::fir::FortranProcedureFlagsEnumAttr>([&](auto t) {
      printer << ::fir::FortranProcedureFlagsEnumAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Case<::fir::ReduceAttr>([&](auto t) {
      printer << ::fir::ReduceAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Case<::fir::LocationKindAttr>([&](auto t) {
      printer << ::fir::LocationKindAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Case<::fir::LocationKindArrayAttr>([&](auto t) {
      printer << ::fir::LocationKindArrayAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Case<::fir::PackArrayHeuristicsAttr>([&](auto t) {
      printer << ::fir::PackArrayHeuristicsAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Case<::fir::OpenACCSafeTempArrayCopyAttr>([&](auto t) {
      printer << ::fir::OpenACCSafeTempArrayCopyAttr::getMnemonic();
      return ::mlir::success();
    })
    .Case<::fir::OpenMPSafeTempArrayCopyAttr>([&](auto t) {
      printer << ::fir::OpenMPSafeTempArrayCopyAttr::getMnemonic();
      return ::mlir::success();
    })
    .Case<::fir::LocalitySpecifierTypeAttr>([&](auto t) {
      printer << ::fir::LocalitySpecifierTypeAttr::getMnemonic();
t.print(printer);
      return ::mlir::success();
    })
    .Default([](auto) { return ::mlir::failure(); });
}

namespace fir {
namespace detail {
struct FortranVariableFlagsAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<FortranVariableFlagsEnum>;
  FortranVariableFlagsAttrStorage(FortranVariableFlagsEnum flags) : flags(std::move(flags)) {}

  KeyTy getAsKey() const {
    return KeyTy(flags);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (flags == std::get<0>(tblgenKey));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static FortranVariableFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto flags = std::move(std::get<0>(tblgenKey));
    return new (allocator.allocate<FortranVariableFlagsAttrStorage>()) FortranVariableFlagsAttrStorage(std::move(flags));
  }

  FortranVariableFlagsEnum flags;
};
} // namespace detail
FortranVariableFlagsAttr FortranVariableFlagsAttr::get(::mlir::MLIRContext *context, FortranVariableFlagsEnum flags) {
  return Base::get(context, std::move(flags));
}

FortranVariableFlagsEnum FortranVariableFlagsAttr::getFlags() const {
  return getImpl()->flags;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::FortranVariableFlagsAttr)
namespace fir {
namespace detail {
struct FortranProcedureFlagsEnumAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<::fir::FortranProcedureFlagsEnum>;
  FortranProcedureFlagsEnumAttrStorage(::fir::FortranProcedureFlagsEnum value) : value(std::move(value)) {}

  KeyTy getAsKey() const {
    return KeyTy(value);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (value == std::get<0>(tblgenKey));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static FortranProcedureFlagsEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto value = std::move(std::get<0>(tblgenKey));
    return new (allocator.allocate<FortranProcedureFlagsEnumAttrStorage>()) FortranProcedureFlagsEnumAttrStorage(std::move(value));
  }

  ::fir::FortranProcedureFlagsEnum value;
};
} // namespace detail
FortranProcedureFlagsEnumAttr FortranProcedureFlagsEnumAttr::get(::mlir::MLIRContext *context, ::fir::FortranProcedureFlagsEnum value) {
  return Base::get(context, std::move(value));
}

::mlir::Attribute FortranProcedureFlagsEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
  ::mlir::Builder odsBuilder(odsParser.getContext());
  ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
  (void) odsLoc;
  ::mlir::FailureOr<::fir::FortranProcedureFlagsEnum> _result_value;
  // Parse literal '<'
  if (odsParser.parseLess()) return {};

  // Parse variable 'value'
  _result_value = [&]() -> ::mlir::FailureOr<::fir::FortranProcedureFlagsEnum> {
      ::fir::FortranProcedureFlagsEnum flags = {};
      auto loc = odsParser.getCurrentLocation();
      std::string enumKeyword;
      do {
        if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
          return ::mlir::failure();
        auto maybeEnum = ::fir::symbolizeFortranProcedureFlagsEnum(enumKeyword);
        if (!maybeEnum) {
            return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::fir::FortranProcedureFlagsEnum" << " to be one of: " << "none" << ", " << "elemental" << ", " << "pure" << ", " << "non_recursive" << ", " << "simple" << ", " << "bind_c")};
        }
        flags = flags | *maybeEnum;
      } while(::mlir::succeeded(odsParser.parseOptionalComma()));
      return flags;
    }();
  if (::mlir::failed(_result_value)) {
    odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse fir_FortranProcedureFlagsAttr parameter 'value' which is to be a `::fir::FortranProcedureFlagsEnum`");
    return {};
  }
  // Parse literal '>'
  if (odsParser.parseGreater()) return {};
  assert(::mlir::succeeded(_result_value));
  return FortranProcedureFlagsEnumAttr::get(odsParser.getContext(),
      ::fir::FortranProcedureFlagsEnum((*_result_value)));
}

void FortranProcedureFlagsEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const {
  ::mlir::Builder odsBuilder(getContext());
  odsPrinter << "<";
  odsPrinter << stringifyFortranProcedureFlagsEnum(getValue());
  odsPrinter << ">";
}

::fir::FortranProcedureFlagsEnum FortranProcedureFlagsEnumAttr::getValue() const {
  return getImpl()->value;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::FortranProcedureFlagsEnumAttr)
namespace fir {
namespace detail {
struct ReduceAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<ReduceOperationEnum>;
  ReduceAttrStorage(ReduceOperationEnum reduce_operation) : reduce_operation(std::move(reduce_operation)) {}

  KeyTy getAsKey() const {
    return KeyTy(reduce_operation);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (reduce_operation == std::get<0>(tblgenKey));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static ReduceAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto reduce_operation = std::move(std::get<0>(tblgenKey));
    return new (allocator.allocate<ReduceAttrStorage>()) ReduceAttrStorage(std::move(reduce_operation));
  }

  ReduceOperationEnum reduce_operation;
};
} // namespace detail
ReduceAttr ReduceAttr::get(::mlir::MLIRContext *context, ReduceOperationEnum reduce_operation) {
  return Base::get(context, std::move(reduce_operation));
}

::mlir::Attribute ReduceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
  ::mlir::Builder odsBuilder(odsParser.getContext());
  ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
  (void) odsLoc;
  ::mlir::FailureOr<ReduceOperationEnum> _result_reduce_operation;
  // Parse literal '<'
  if (odsParser.parseLess()) return {};

  // Parse variable 'reduce_operation'
  _result_reduce_operation = ::mlir::FieldParser<ReduceOperationEnum>::parse(odsParser);
  if (::mlir::failed(_result_reduce_operation)) {
    odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse fir_ReduceAttr parameter 'reduce_operation' which is to be a `ReduceOperationEnum`");
    return {};
  }
  // Parse literal '>'
  if (odsParser.parseGreater()) return {};
  assert(::mlir::succeeded(_result_reduce_operation));
  return ReduceAttr::get(odsParser.getContext(),
      ReduceOperationEnum((*_result_reduce_operation)));
}

void ReduceAttr::print(::mlir::AsmPrinter &odsPrinter) const {
  ::mlir::Builder odsBuilder(getContext());
  odsPrinter << "<";
  odsPrinter.printStrippedAttrOrType(getReduceOperation());
  odsPrinter << ">";
}

ReduceOperationEnum ReduceAttr::getReduceOperation() const {
  return getImpl()->reduce_operation;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::ReduceAttr)
namespace fir {
namespace detail {
struct LocationKindAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<::fir::LocationKind>;
  LocationKindAttrStorage(::fir::LocationKind value) : value(std::move(value)) {}

  KeyTy getAsKey() const {
    return KeyTy(value);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (value == std::get<0>(tblgenKey));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static LocationKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto value = std::move(std::get<0>(tblgenKey));
    return new (allocator.allocate<LocationKindAttrStorage>()) LocationKindAttrStorage(std::move(value));
  }

  ::fir::LocationKind value;
};
} // namespace detail
LocationKindAttr LocationKindAttr::get(::mlir::MLIRContext *context, ::fir::LocationKind value) {
  return Base::get(context, std::move(value));
}

::mlir::Attribute LocationKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
  ::mlir::Builder odsBuilder(odsParser.getContext());
  ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
  (void) odsLoc;
  ::mlir::FailureOr<::fir::LocationKind> _result_value;

  // Parse variable 'value'
  _result_value = [&]() -> ::mlir::FailureOr<::fir::LocationKind> {
      auto loc = odsParser.getCurrentLocation();
      std::string enumKeyword;
      if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
        return ::mlir::failure();
      auto maybeEnum = ::fir::symbolizeLocationKind(enumKeyword);
      if (maybeEnum)
        return *maybeEnum;
      return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::fir::LocationKind" << " to be one of: " << "base" << ", " << "inclusion")};
    }();
  if (::mlir::failed(_result_value)) {
    odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse fir_LocationKindAttr parameter 'value' which is to be a `::fir::LocationKind`");
    return {};
  }
  assert(::mlir::succeeded(_result_value));
  return LocationKindAttr::get(odsParser.getContext(),
      ::fir::LocationKind((*_result_value)));
}

void LocationKindAttr::print(::mlir::AsmPrinter &odsPrinter) const {
  ::mlir::Builder odsBuilder(getContext());
  odsPrinter << ' ';
  odsPrinter << stringifyLocationKind(getValue());
}

::fir::LocationKind LocationKindAttr::getValue() const {
  return getImpl()->value;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::LocationKindAttr)
namespace fir {
namespace detail {
struct LocationKindArrayAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<::llvm::ArrayRef<LocationKindAttr>>;
  LocationKindArrayAttrStorage(::llvm::ArrayRef<LocationKindAttr> value) : value(std::move(value)) {}

  KeyTy getAsKey() const {
    return KeyTy(value);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (::llvm::ArrayRef<LocationKindAttr>(value) == ::llvm::ArrayRef<LocationKindAttr>(std::get<0>(tblgenKey)));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static LocationKindArrayAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto value = std::move(std::get<0>(tblgenKey));
    value = allocator.copyInto(value);
    return new (allocator.allocate<LocationKindArrayAttrStorage>()) LocationKindArrayAttrStorage(std::move(value));
  }

  ::llvm::ArrayRef<LocationKindAttr> value;
};
} // namespace detail
LocationKindArrayAttr LocationKindArrayAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<LocationKindAttr> value) {
  return Base::get(context, std::move(value));
}

::mlir::Attribute LocationKindArrayAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
  ::mlir::Builder odsBuilder(odsParser.getContext());
  ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
  (void) odsLoc;
  ::mlir::FailureOr<::llvm::SmallVector<LocationKindAttr>> _result_value;
  // Parse literal '['
  if (odsParser.parseLSquare()) return {};
  // Parse literal ']'
  if (odsParser.parseOptionalRSquare()) {

    // Parse variable 'value'
    _result_value = ::mlir::FieldParser<::llvm::SmallVector<LocationKindAttr>>::parse(odsParser);
    if (::mlir::failed(_result_value)) {
      odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LocationKindArrayAttr parameter 'value' which is to be a `::llvm::ArrayRef<LocationKindAttr>`");
      return {};
    }
    // Parse literal ']'
    if (odsParser.parseRSquare()) return {};
  } else {
  }
  return LocationKindArrayAttr::get(odsParser.getContext(),
      ::llvm::ArrayRef<LocationKindAttr>((_result_value.value_or(::llvm::SmallVector<LocationKindAttr>()))));
}

void LocationKindArrayAttr::print(::mlir::AsmPrinter &odsPrinter) const {
  ::mlir::Builder odsBuilder(getContext());
  odsPrinter << "[";
  if (!(!(::llvm::ArrayRef<LocationKindAttr>(getValue()) == ::llvm::ArrayRef<LocationKindAttr>(::llvm::SmallVector<LocationKindAttr>())))) {
    odsPrinter << "]";
  } else {
    if (!(::llvm::ArrayRef<LocationKindAttr>(getValue()) == ::llvm::ArrayRef<LocationKindAttr>(::llvm::SmallVector<LocationKindAttr>()))) {
      odsPrinter.printStrippedAttrOrType(getValue());
    }
    odsPrinter << "]";
  }
}

::llvm::ArrayRef<LocationKindAttr> LocationKindArrayAttr::getValue() const {
  return getImpl()->value;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::LocationKindArrayAttr)
namespace fir {
namespace detail {
struct PackArrayHeuristicsAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<::fir::PackArrayHeuristics>;
  PackArrayHeuristicsAttrStorage(::fir::PackArrayHeuristics value) : value(std::move(value)) {}

  KeyTy getAsKey() const {
    return KeyTy(value);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (value == std::get<0>(tblgenKey));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static PackArrayHeuristicsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto value = std::move(std::get<0>(tblgenKey));
    return new (allocator.allocate<PackArrayHeuristicsAttrStorage>()) PackArrayHeuristicsAttrStorage(std::move(value));
  }

  ::fir::PackArrayHeuristics value;
};
} // namespace detail
PackArrayHeuristicsAttr PackArrayHeuristicsAttr::get(::mlir::MLIRContext *context, ::fir::PackArrayHeuristics value) {
  return Base::get(context, std::move(value));
}

::mlir::Attribute PackArrayHeuristicsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
  ::mlir::Builder odsBuilder(odsParser.getContext());
  ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
  (void) odsLoc;
  ::mlir::FailureOr<::fir::PackArrayHeuristics> _result_value;
  // Parse literal '<'
  if (odsParser.parseLess()) return {};

  // Parse variable 'value'
  _result_value = [&]() -> ::mlir::FailureOr<::fir::PackArrayHeuristics> {
      ::fir::PackArrayHeuristics flags = {};
      auto loc = odsParser.getCurrentLocation();
      std::string enumKeyword;
      do {
        if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
          return ::mlir::failure();
        auto maybeEnum = ::fir::symbolizePackArrayHeuristics(enumKeyword);
        if (!maybeEnum) {
            return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::fir::PackArrayHeuristics" << " to be one of: " << "none" << ", " << "loop_only")};
        }
        flags = flags | *maybeEnum;
      } while(::mlir::succeeded(odsParser.parseOptionalComma()));
      return flags;
    }();
  if (::mlir::failed(_result_value)) {
    odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse fir_PackArrayHeuristicsAttr parameter 'value' which is to be a `::fir::PackArrayHeuristics`");
    return {};
  }
  // Parse literal '>'
  if (odsParser.parseGreater()) return {};
  assert(::mlir::succeeded(_result_value));
  return PackArrayHeuristicsAttr::get(odsParser.getContext(),
      ::fir::PackArrayHeuristics((*_result_value)));
}

void PackArrayHeuristicsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
  ::mlir::Builder odsBuilder(getContext());
  odsPrinter << "<";
  odsPrinter << stringifyPackArrayHeuristics(getValue());
  odsPrinter << ">";
}

::fir::PackArrayHeuristics PackArrayHeuristicsAttr::getValue() const {
  return getImpl()->value;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::PackArrayHeuristicsAttr)
namespace fir {
} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::OpenACCSafeTempArrayCopyAttr)
namespace fir {
} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::OpenMPSafeTempArrayCopyAttr)
namespace fir {
namespace detail {
struct LocalitySpecifierTypeAttrStorage : public ::mlir::AttributeStorage {
  using KeyTy = std::tuple<::fir::LocalitySpecifierType>;
  LocalitySpecifierTypeAttrStorage(::fir::LocalitySpecifierType value) : value(std::move(value)) {}

  KeyTy getAsKey() const {
    return KeyTy(value);
  }

  bool operator==(const KeyTy &tblgenKey) const {
    return (value == std::get<0>(tblgenKey));
  }

  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
    return ::llvm::hash_combine(std::get<0>(tblgenKey));
  }

  static LocalitySpecifierTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
    auto value = std::move(std::get<0>(tblgenKey));
    return new (allocator.allocate<LocalitySpecifierTypeAttrStorage>()) LocalitySpecifierTypeAttrStorage(std::move(value));
  }

  ::fir::LocalitySpecifierType value;
};
} // namespace detail
LocalitySpecifierTypeAttr LocalitySpecifierTypeAttr::get(::mlir::MLIRContext *context, ::fir::LocalitySpecifierType value) {
  return Base::get(context, std::move(value));
}

::mlir::Attribute LocalitySpecifierTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
  ::mlir::Builder odsBuilder(odsParser.getContext());
  ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
  (void) odsLoc;
  ::mlir::FailureOr<::fir::LocalitySpecifierType> _result_value;
  // Parse literal '{'
  if (odsParser.parseLBrace()) return {};
  // Parse literal 'type'
  if (odsParser.parseKeyword("type")) return {};
  // Parse literal '='
  if (odsParser.parseEqual()) return {};

  // Parse variable 'value'
  _result_value = [&]() -> ::mlir::FailureOr<::fir::LocalitySpecifierType> {
      auto loc = odsParser.getCurrentLocation();
      std::string enumKeyword;
      if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
        return ::mlir::failure();
      auto maybeEnum = ::fir::symbolizeLocalitySpecifierType(enumKeyword);
      if (maybeEnum)
        return *maybeEnum;
      return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::fir::LocalitySpecifierType" << " to be one of: " << "local" << ", " << "local_init")};
    }();
  if (::mlir::failed(_result_value)) {
    odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LocalitySpecifierTypeAttr parameter 'value' which is to be a `::fir::LocalitySpecifierType`");
    return {};
  }
  // Parse literal '}'
  if (odsParser.parseRBrace()) return {};
  assert(::mlir::succeeded(_result_value));
  return LocalitySpecifierTypeAttr::get(odsParser.getContext(),
      ::fir::LocalitySpecifierType((*_result_value)));
}

void LocalitySpecifierTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
  ::mlir::Builder odsBuilder(getContext());
  odsPrinter << "{";
  odsPrinter << "type";
  odsPrinter << ' ' << "=";
  odsPrinter << ' ';
  odsPrinter << stringifyLocalitySpecifierType(getValue());
  odsPrinter << "}";
}

::fir::LocalitySpecifierType LocalitySpecifierTypeAttr::getValue() const {
  return getImpl()->value;
}

} // namespace fir
MLIR_DEFINE_EXPLICIT_TYPE_ID(::fir::LocalitySpecifierTypeAttr)

#endif  // GET_ATTRDEF_CLASSES

