forked from OSchip/llvm-project
[mlir, flang] Use has_value instead of hasValue (NFC)
This commit is contained in:
parent
486a3c4662
commit
9750648cb4
|
@ -1105,7 +1105,7 @@ mlir::ParseResult fir::DispatchTableOp::parse(mlir::OpAsmParser &parser,
|
|||
// Parse the optional table body.
|
||||
mlir::Region *body = result.addRegion();
|
||||
mlir::OptionalParseResult parseResult = parser.parseOptionalRegion(*body);
|
||||
if (parseResult.hasValue() && failed(*parseResult))
|
||||
if (parseResult.has_value() && failed(*parseResult))
|
||||
return mlir::failure();
|
||||
|
||||
fir::DispatchTableOp::ensureTerminator(*body, parser.getBuilder(),
|
||||
|
@ -1287,7 +1287,7 @@ mlir::ParseResult fir::GlobalOp::parse(mlir::OpAsmParser &parser,
|
|||
// Parse the optional initializer body.
|
||||
auto parseResult =
|
||||
parser.parseOptionalRegion(*result.addRegion(), /*arguments=*/{});
|
||||
if (parseResult.hasValue() && mlir::failed(*parseResult))
|
||||
if (parseResult.has_value() && mlir::failed(*parseResult))
|
||||
return mlir::failure();
|
||||
}
|
||||
return mlir::success();
|
||||
|
|
|
@ -118,7 +118,7 @@ mlir::Type fir::parseFirType(FIROpsDialect *dialect,
|
|||
mlir::StringRef typeTag;
|
||||
mlir::Type genType;
|
||||
auto parseResult = generatedTypeParser(parser, &typeTag, genType);
|
||||
if (parseResult.hasValue())
|
||||
if (parseResult.has_value())
|
||||
return genType;
|
||||
parser.emitError(parser.getNameLoc(), "unknown fir type: ") << typeTag;
|
||||
return {};
|
||||
|
|
|
@ -605,7 +605,7 @@ public:
|
|||
ParseResult parseInteger(IntT &result) {
|
||||
auto loc = getCurrentLocation();
|
||||
OptionalParseResult parseResult = parseOptionalInteger(result);
|
||||
if (!parseResult.hasValue())
|
||||
if (!parseResult.has_value())
|
||||
return emitError(loc, "expected integer value");
|
||||
return *parseResult;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ public:
|
|||
// Parse the unsigned variant.
|
||||
APInt uintResult;
|
||||
OptionalParseResult parseResult = parseOptionalInteger(uintResult);
|
||||
if (!parseResult.hasValue() || failed(*parseResult))
|
||||
if (!parseResult.has_value() || failed(*parseResult))
|
||||
return parseResult;
|
||||
|
||||
// Try to convert to the provided integer type. sextOrTrunc is correct even
|
||||
|
@ -976,7 +976,7 @@ public:
|
|||
StringRef attrName,
|
||||
NamedAttrList &attrs) {
|
||||
OptionalParseResult parseResult = parseOptionalAttribute(result, type);
|
||||
if (parseResult.hasValue() && succeeded(*parseResult))
|
||||
if (parseResult.has_value() && succeeded(*parseResult))
|
||||
attrs.append(attrName, result);
|
||||
return parseResult;
|
||||
}
|
||||
|
@ -1502,7 +1502,7 @@ public:
|
|||
ParseResult parseAssignmentList(SmallVectorImpl<Argument> &lhs,
|
||||
SmallVectorImpl<UnresolvedOperand> &rhs) {
|
||||
OptionalParseResult result = parseOptionalAssignmentList(lhs, rhs);
|
||||
if (!result.hasValue())
|
||||
if (!result.has_value())
|
||||
return emitError(getCurrentLocation(), "expected '('");
|
||||
return result.getValue();
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ Attribute Parser::parseAttribute(Type type) {
|
|||
// better error message.
|
||||
Type type;
|
||||
OptionalParseResult result = parseOptionalType(type);
|
||||
if (!result.hasValue())
|
||||
if (!result.has_value())
|
||||
return emitWrongTokenError("expected attribute value"), Attribute();
|
||||
return failed(*result) ? Attribute() : TypeAttr::get(type);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ OptionalParseResult Parser::parseOptionalAttribute(Attribute &attribute,
|
|||
// Parse an optional type attribute.
|
||||
Type type;
|
||||
OptionalParseResult result = parseOptionalType(type);
|
||||
if (result.hasValue() && succeeded(*result))
|
||||
if (result.has_value() && succeeded(*result))
|
||||
attribute = TypeAttr::get(type);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -73,11 +73,11 @@ DataLayoutEntryAttr DataLayoutEntryAttr::parse(AsmParser &parser) {
|
|||
std::string identifier;
|
||||
SMLoc idLoc = parser.getCurrentLocation();
|
||||
OptionalParseResult parsedType = parser.parseOptionalType(type);
|
||||
if (parsedType.hasValue() && failed(parsedType.getValue()))
|
||||
if (parsedType.has_value() && failed(parsedType.getValue()))
|
||||
return {};
|
||||
if (!parsedType.hasValue()) {
|
||||
if (!parsedType.has_value()) {
|
||||
OptionalParseResult parsedString = parser.parseOptionalString(&identifier);
|
||||
if (!parsedString.hasValue() || failed(parsedString.getValue())) {
|
||||
if (!parsedString.has_value() || failed(parsedString.getValue())) {
|
||||
parser.emitError(idLoc) << "expected a type or a quoted string";
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ ParseResult IncludeOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
StringAttr include;
|
||||
OptionalParseResult includeParseResult =
|
||||
parser.parseOptionalAttribute(include, "include", result.attributes);
|
||||
if (!includeParseResult.hasValue())
|
||||
if (!includeParseResult.has_value())
|
||||
return parser.emitError(parser.getNameLoc()) << "expected string attribute";
|
||||
|
||||
if (standardInclude && parser.parseOptionalGreater())
|
||||
|
|
|
@ -341,10 +341,10 @@ static ParseResult parseSwitchOpCases(
|
|||
do {
|
||||
int64_t value = 0;
|
||||
OptionalParseResult integerParseResult = parser.parseOptionalInteger(value);
|
||||
if (values.empty() && !integerParseResult.hasValue())
|
||||
if (values.empty() && !integerParseResult.has_value())
|
||||
return success();
|
||||
|
||||
if (!integerParseResult.hasValue() || integerParseResult.getValue())
|
||||
if (!integerParseResult.has_value() || integerParseResult.getValue())
|
||||
return failure();
|
||||
values.push_back(APInt(bitWidth, value));
|
||||
|
||||
|
@ -541,7 +541,7 @@ parseGEPIndices(OpAsmParser &parser,
|
|||
int32_t constantIndex;
|
||||
OptionalParseResult parsedInteger =
|
||||
parser.parseOptionalInteger(constantIndex);
|
||||
if (parsedInteger.hasValue()) {
|
||||
if (parsedInteger.has_value()) {
|
||||
if (failed(parsedInteger.getValue()))
|
||||
return failure();
|
||||
constantIndices.push_back(constantIndex);
|
||||
|
@ -1965,7 +1965,7 @@ ParseResult GlobalOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
OptionalParseResult parseResult =
|
||||
parser.parseOptionalRegion(initRegion, /*arguments=*/{},
|
||||
/*argTypes=*/{});
|
||||
if (parseResult.hasValue() && failed(*parseResult))
|
||||
if (parseResult.has_value() && failed(*parseResult))
|
||||
return failure();
|
||||
}
|
||||
|
||||
|
@ -2298,7 +2298,7 @@ ParseResult LLVMFuncOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
auto *body = result.addRegion();
|
||||
OptionalParseResult parseResult =
|
||||
parser.parseOptionalRegion(*body, entryArgs);
|
||||
return failure(parseResult.hasValue() && failed(*parseResult));
|
||||
return failure(parseResult.has_value() && failed(*parseResult));
|
||||
}
|
||||
|
||||
// Print the LLVMFuncOp. Collects argument and result types and passes them to
|
||||
|
|
|
@ -232,7 +232,7 @@ static LLVMPointerType parsePointerType(AsmParser &parser) {
|
|||
|
||||
unsigned addressSpace = 0;
|
||||
OptionalParseResult opr = parser.parseOptionalInteger(addressSpace);
|
||||
if (opr.hasValue()) {
|
||||
if (opr.has_value()) {
|
||||
if (failed(*opr) || parser.parseGreater())
|
||||
return LLVMPointerType();
|
||||
return parser.getChecked<LLVMPointerType>(loc, parser.getContext(),
|
||||
|
@ -441,7 +441,7 @@ static Type dispatchParse(AsmParser &parser, bool allowAny = true) {
|
|||
// Try parsing any MLIR type.
|
||||
Type type;
|
||||
OptionalParseResult result = parser.parseOptionalType(type);
|
||||
if (result.hasValue()) {
|
||||
if (result.has_value()) {
|
||||
if (failed(result.getValue()))
|
||||
return nullptr;
|
||||
if (!allowAny) {
|
||||
|
|
|
@ -775,7 +775,7 @@ ParseResult SplitOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
|
||||
OptionalParseResult dynamicPointParseResult =
|
||||
parser.parseOptionalOperand(dynamicSplitPoint);
|
||||
if (!dynamicPointParseResult.hasValue()) {
|
||||
if (!dynamicPointParseResult.has_value()) {
|
||||
int64_t staticSplitPointValue;
|
||||
if (failed(parser.parseInteger(staticSplitPointValue)))
|
||||
return failure();
|
||||
|
|
|
@ -243,7 +243,7 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
// async()?
|
||||
async = parseOptionalOperandAndType(parser, ParallelOp::getAsyncKeyword(),
|
||||
result);
|
||||
if (async.hasValue() && failed(*async))
|
||||
if (async.has_value() && failed(*async))
|
||||
return failure();
|
||||
|
||||
// wait()?
|
||||
|
@ -254,19 +254,19 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
// num_gangs(value)?
|
||||
numGangs = parseOptionalOperandAndType(
|
||||
parser, ParallelOp::getNumGangsKeyword(), result);
|
||||
if (numGangs.hasValue() && failed(*numGangs))
|
||||
if (numGangs.has_value() && failed(*numGangs))
|
||||
return failure();
|
||||
|
||||
// num_workers(value)?
|
||||
numWorkers = parseOptionalOperandAndType(
|
||||
parser, ParallelOp::getNumWorkersKeyword(), result);
|
||||
if (numWorkers.hasValue() && failed(*numWorkers))
|
||||
if (numWorkers.has_value() && failed(*numWorkers))
|
||||
return failure();
|
||||
|
||||
// vector_length(value)?
|
||||
vectorLength = parseOptionalOperandAndType(
|
||||
parser, ParallelOp::getVectorLengthKeyword(), result);
|
||||
if (vectorLength.hasValue() && failed(*vectorLength))
|
||||
if (vectorLength.has_value() && failed(*vectorLength))
|
||||
return failure();
|
||||
|
||||
// if()?
|
||||
|
@ -362,11 +362,11 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
result.addAttribute(
|
||||
ParallelOp::getOperandSegmentSizeAttr(),
|
||||
builder.getI32VectorAttr(
|
||||
{static_cast<int32_t>(async.hasValue() ? 1 : 0),
|
||||
{static_cast<int32_t>(async.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(waitOperands.size()),
|
||||
static_cast<int32_t>(numGangs.hasValue() ? 1 : 0),
|
||||
static_cast<int32_t>(numWorkers.hasValue() ? 1 : 0),
|
||||
static_cast<int32_t>(vectorLength.hasValue() ? 1 : 0),
|
||||
static_cast<int32_t>(numGangs.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(numWorkers.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(vectorLength.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(hasIfCond ? 1 : 0),
|
||||
static_cast<int32_t>(hasSelfCond ? 1 : 0),
|
||||
static_cast<int32_t>(reductionOperands.size()),
|
||||
|
@ -531,13 +531,13 @@ ParseResult LoopOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
if (succeeded(parser.parseOptionalLParen())) {
|
||||
gangNum = parserOptionalOperandAndTypeWithPrefix(
|
||||
parser, result, LoopOp::getGangNumKeyword());
|
||||
if (gangNum.hasValue() && failed(*gangNum))
|
||||
if (gangNum.has_value() && failed(*gangNum))
|
||||
return failure();
|
||||
// FIXME: Comma should require subsequent operands.
|
||||
(void)parser.parseOptionalComma();
|
||||
gangStatic = parserOptionalOperandAndTypeWithPrefix(
|
||||
parser, result, LoopOp::getGangStaticKeyword());
|
||||
if (gangStatic.hasValue() && failed(*gangStatic))
|
||||
if (gangStatic.has_value() && failed(*gangStatic))
|
||||
return failure();
|
||||
// FIXME: Why allow optional last commas?
|
||||
(void)parser.parseOptionalComma();
|
||||
|
@ -551,7 +551,7 @@ ParseResult LoopOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
|
||||
// optional worker operand
|
||||
worker = parseOptionalOperandAndType(parser, result);
|
||||
if (worker.hasValue() && failed(*worker))
|
||||
if (worker.has_value() && failed(*worker))
|
||||
return failure();
|
||||
|
||||
// vector?
|
||||
|
@ -560,7 +560,7 @@ ParseResult LoopOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
|
||||
// optional vector operand
|
||||
vector = parseOptionalOperandAndType(parser, result);
|
||||
if (vector.hasValue() && failed(*vector))
|
||||
if (vector.has_value() && failed(*vector))
|
||||
return failure();
|
||||
|
||||
// tile()?
|
||||
|
@ -591,10 +591,10 @@ ParseResult LoopOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
|
||||
result.addAttribute(LoopOp::getOperandSegmentSizeAttr(),
|
||||
builder.getI32VectorAttr(
|
||||
{static_cast<int32_t>(gangNum.hasValue() ? 1 : 0),
|
||||
static_cast<int32_t>(gangStatic.hasValue() ? 1 : 0),
|
||||
static_cast<int32_t>(worker.hasValue() ? 1 : 0),
|
||||
static_cast<int32_t>(vector.hasValue() ? 1 : 0),
|
||||
{static_cast<int32_t>(gangNum.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(gangStatic.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(worker.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(vector.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(tileOperands.size()),
|
||||
static_cast<int32_t>(privateOperands.size()),
|
||||
static_cast<int32_t>(reductionOperands.size())}));
|
||||
|
|
|
@ -38,7 +38,7 @@ static Type parsePDLType(AsmParser &parser) {
|
|||
{
|
||||
Type genType;
|
||||
auto parseResult = generatedTypeParser(parser, &typeTag, genType);
|
||||
if (parseResult.hasValue())
|
||||
if (parseResult.has_value())
|
||||
return genType;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ static IntegerType parseStorageType(DialectAsmParser &parser, bool &isSigned) {
|
|||
StringRef identifier;
|
||||
unsigned storageTypeWidth = 0;
|
||||
OptionalParseResult result = parser.parseOptionalType(type);
|
||||
if (result.hasValue()) {
|
||||
if (result.has_value()) {
|
||||
if (!succeeded(*result))
|
||||
return nullptr;
|
||||
isSigned = !type.isUnsigned();
|
||||
|
|
|
@ -2613,7 +2613,7 @@ ParseResult scf::WhileOp::parse(OpAsmParser &parser, OperationState &result) {
|
|||
|
||||
OptionalParseResult listResult =
|
||||
parser.parseOptionalAssignmentList(regionArgs, operands);
|
||||
if (listResult.hasValue() && failed(listResult.getValue()))
|
||||
if (listResult.has_value() && failed(listResult.getValue()))
|
||||
return failure();
|
||||
|
||||
FunctionType functionType;
|
||||
|
|
|
@ -387,7 +387,7 @@ static Attribute parseInterfaceVarABIAttr(DialectAsmParser &parser) {
|
|||
uint32_t descriptorSet = 0;
|
||||
auto descriptorSetParseResult = parser.parseOptionalInteger(descriptorSet);
|
||||
|
||||
if (!descriptorSetParseResult.hasValue() ||
|
||||
if (!descriptorSetParseResult.has_value() ||
|
||||
failed(*descriptorSetParseResult)) {
|
||||
parser.emitError(loc, "missing descriptor set");
|
||||
return {};
|
||||
|
@ -404,7 +404,7 @@ static Attribute parseInterfaceVarABIAttr(DialectAsmParser &parser) {
|
|||
uint32_t binding = 0;
|
||||
auto bindingParseResult = parser.parseOptionalInteger(binding);
|
||||
|
||||
if (!bindingParseResult.hasValue() || failed(*bindingParseResult)) {
|
||||
if (!bindingParseResult.has_value() || failed(*bindingParseResult)) {
|
||||
parser.emitError(loc, "missing binding");
|
||||
return {};
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ Attribute SPIRVDialect::parseAttribute(DialectAsmParser &parser,
|
|||
Attribute attr;
|
||||
OptionalParseResult result =
|
||||
generatedAttributeParser(parser, &attrKind, type, attr);
|
||||
if (result.hasValue())
|
||||
if (result.has_value())
|
||||
return attr;
|
||||
|
||||
if (attrKind == spirv::TargetEnvAttr::getKindName())
|
||||
|
|
|
@ -573,7 +573,7 @@ static ParseResult parseStructMemberDecorations(
|
|||
SMLoc offsetLoc = parser.getCurrentLocation();
|
||||
StructType::OffsetInfo offset = 0;
|
||||
OptionalParseResult offsetParseResult = parser.parseOptionalInteger(offset);
|
||||
if (offsetParseResult.hasValue()) {
|
||||
if (offsetParseResult.has_value()) {
|
||||
if (failed(*offsetParseResult))
|
||||
return failure();
|
||||
|
||||
|
@ -590,7 +590,7 @@ static ParseResult parseStructMemberDecorations(
|
|||
return success();
|
||||
|
||||
// If there was an offset, make sure to parse the comma.
|
||||
if (offsetParseResult.hasValue() && parser.parseComma())
|
||||
if (offsetParseResult.has_value() && parser.parseComma())
|
||||
return failure();
|
||||
|
||||
// Check for spirv::Decorations.
|
||||
|
|
|
@ -2236,7 +2236,7 @@ ParseResult spirv::FuncOp::parse(OpAsmParser &parser, OperationState &state) {
|
|||
// Parse the optional function body.
|
||||
auto *body = state.addRegion();
|
||||
OptionalParseResult result = parser.parseOptionalRegion(*body, entryArgs);
|
||||
return failure(result.hasValue() && failed(*result));
|
||||
return failure(result.has_value() && failed(*result));
|
||||
}
|
||||
|
||||
void spirv::FuncOp::print(OpAsmPrinter &printer) {
|
||||
|
|
|
@ -41,7 +41,7 @@ parseFunctionArgumentList(OpAsmParser &parser, bool allowVariadic,
|
|||
OpAsmParser::Argument argument;
|
||||
auto argPresent = parser.parseOptionalArgument(
|
||||
argument, /*allowType=*/true, /*allowAttrs=*/true);
|
||||
if (argPresent.hasValue()) {
|
||||
if (argPresent.has_value()) {
|
||||
if (failed(argPresent.getValue()))
|
||||
return failure(); // Present but malformed.
|
||||
|
||||
|
@ -229,7 +229,7 @@ ParseResult mlir::function_interface_impl::parseFunctionOp(
|
|||
OptionalParseResult parseResult =
|
||||
parser.parseOptionalRegion(*body, entryArgs,
|
||||
/*enableNameShadowing=*/false);
|
||||
if (parseResult.hasValue()) {
|
||||
if (parseResult.has_value()) {
|
||||
if (failed(*parseResult))
|
||||
return failure();
|
||||
// Function body was parsed, make sure its not empty.
|
||||
|
|
|
@ -121,7 +121,7 @@ static ParseResult parseOperandsOrIntegersImpl(
|
|||
while (true) {
|
||||
OpAsmParser::UnresolvedOperand operand;
|
||||
auto res = parser.parseOptionalOperand(operand);
|
||||
if (res.hasValue() && succeeded(res.getValue())) {
|
||||
if (res.has_value() && succeeded(res.getValue())) {
|
||||
values.push_back(operand);
|
||||
attrVals.push_back(dynVal);
|
||||
} else {
|
||||
|
|
|
@ -292,9 +292,9 @@ class DefaultValuedAPFloat<string value>
|
|||
let parser = [{ [&]() -> mlir::FailureOr<llvm::Optional<llvm::APFloat>> {
|
||||
mlir::FloatAttr attr;
|
||||
auto result = $_parser.parseOptionalAttribute(attr);
|
||||
if (result.hasValue() && mlir::succeeded(*result))
|
||||
if (result.has_value() && mlir::succeeded(*result))
|
||||
return {attr.getValue()};
|
||||
if (!result.hasValue())
|
||||
if (!result.has_value())
|
||||
return llvm::Optional<llvm::APFloat>();
|
||||
return mlir::failure();
|
||||
}() }];
|
||||
|
|
|
@ -411,14 +411,14 @@ Type TestDialect::parseTestType(AsmParser &parser,
|
|||
{
|
||||
Type genType;
|
||||
auto parseResult = generatedTypeParser(parser, &typeTag, genType);
|
||||
if (parseResult.hasValue())
|
||||
if (parseResult.has_value())
|
||||
return genType;
|
||||
}
|
||||
|
||||
{
|
||||
Type dynType;
|
||||
auto parseResult = parseOptionalDynamicType(typeTag, parser, dynType);
|
||||
if (parseResult.hasValue()) {
|
||||
if (parseResult.has_value()) {
|
||||
if (succeeded(parseResult.getValue()))
|
||||
return dynType;
|
||||
return Type();
|
||||
|
|
|
@ -78,7 +78,7 @@ struct FieldParser<Optional<int>> {
|
|||
Optional<int> value;
|
||||
value.emplace();
|
||||
OptionalParseResult result = parser.parseOptionalInteger(*value);
|
||||
if (result.hasValue()) {
|
||||
if (result.has_value()) {
|
||||
if (succeeded(*result))
|
||||
return value;
|
||||
return failure();
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
static ParseResult parse(OpAsmParser &parser, OperationState &state) {
|
||||
StringAttr message;
|
||||
OptionalParseResult result = parser.parseOptionalAttribute(message);
|
||||
if (!result.hasValue())
|
||||
if (!result.has_value())
|
||||
return success();
|
||||
|
||||
if (result.getValue().succeeded())
|
||||
|
|
|
@ -30,7 +30,7 @@ def AttrA : TestAttr<"AttrA"> {
|
|||
// ATTR: {
|
||||
// ATTR: ::mlir::Attribute attr;
|
||||
// ATTR: auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
|
||||
// ATTR: if (parseResult.hasValue())
|
||||
// ATTR: if (parseResult.has_value())
|
||||
// ATTR: return attr;
|
||||
// ATTR: }
|
||||
// ATTR: parser.emitError(typeLoc) << "unknown attribute `"
|
||||
|
@ -57,7 +57,7 @@ def TypeA : TestType<"TypeA"> {
|
|||
// TYPE: ::llvm::StringRef mnemonic;
|
||||
// TYPE: ::mlir::Type genType;
|
||||
// TYPE: auto parseResult = generatedTypeParser(parser, &mnemonic, genType);
|
||||
// TYPE: if (parseResult.hasValue())
|
||||
// TYPE: if (parseResult.has_value())
|
||||
// TYPE: return genType;
|
||||
// TYPE: parser.emitError(typeLoc) << "unknown type `"
|
||||
// TYPE: << mnemonic << "` in dialect `" << getNamespace() << "`";
|
||||
|
|
|
@ -660,7 +660,7 @@ static const char *const dialectDefaultAttrPrinterParserDispatch = R"(
|
|||
{{
|
||||
::mlir::Attribute attr;
|
||||
auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
|
||||
if (parseResult.hasValue())
|
||||
if (parseResult.has_value())
|
||||
return attr;
|
||||
}
|
||||
{1}
|
||||
|
@ -682,7 +682,7 @@ static const char *const dialectDynamicAttrParserDispatch = R"(
|
|||
{
|
||||
::mlir::Attribute genAttr;
|
||||
auto parseResult = parseOptionalDynamicAttr(attrTag, parser, genAttr);
|
||||
if (parseResult.hasValue()) {
|
||||
if (parseResult.has_value()) {
|
||||
if (::mlir::succeeded(parseResult.getValue()))
|
||||
return genAttr;
|
||||
return Attribute();
|
||||
|
@ -707,7 +707,7 @@ static const char *const dialectDefaultTypePrinterParserDispatch = R"(
|
|||
::llvm::StringRef mnemonic;
|
||||
::mlir::Type genType;
|
||||
auto parseResult = generatedTypeParser(parser, &mnemonic, genType);
|
||||
if (parseResult.hasValue())
|
||||
if (parseResult.has_value())
|
||||
return genType;
|
||||
{1}
|
||||
parser.emitError(typeLoc) << "unknown type `"
|
||||
|
|
|
@ -408,7 +408,7 @@ const char *const optionalAttrParserCode = R"(
|
|||
{
|
||||
::mlir::OptionalParseResult parseResult =
|
||||
parser.parseOptionalAttribute({0}Attr, {1}, "{0}", result.attributes);
|
||||
if (parseResult.hasValue() && failed(*parseResult))
|
||||
if (parseResult.has_value() && failed(*parseResult))
|
||||
return ::mlir::failure();
|
||||
}
|
||||
)";
|
||||
|
@ -445,7 +445,7 @@ const char *const enumAttrParserCode = R"(
|
|||
parser.parseOptionalAttribute(attrVal,
|
||||
parser.getBuilder().getNoneType(),
|
||||
"{0}", attrStorage);
|
||||
if (parseResult.hasValue()) {{
|
||||
if (parseResult.has_value()) {{
|
||||
if (failed(*parseResult))
|
||||
return ::mlir::failure();
|
||||
attrStr = attrVal.getValue();
|
||||
|
@ -479,7 +479,7 @@ const char *const optionalOperandParserCode = R"(
|
|||
::mlir::OpAsmParser::UnresolvedOperand operand;
|
||||
::mlir::OptionalParseResult parseResult =
|
||||
parser.parseOptionalOperand(operand);
|
||||
if (parseResult.hasValue()) {
|
||||
if (parseResult.has_value()) {
|
||||
if (failed(*parseResult))
|
||||
return ::mlir::failure();
|
||||
{0}Operands.push_back(operand);
|
||||
|
@ -532,7 +532,7 @@ const char *const optionalTypeParserCode = R"(
|
|||
::mlir::Type optionalType;
|
||||
::mlir::OptionalParseResult parseResult =
|
||||
parser.parseOptionalType(optionalType);
|
||||
if (parseResult.hasValue()) {
|
||||
if (parseResult.has_value()) {
|
||||
if (failed(*parseResult))
|
||||
return ::mlir::failure();
|
||||
{0}Types.push_back(optionalType);
|
||||
|
@ -584,7 +584,7 @@ const char *regionListParserCode = R"(
|
|||
{
|
||||
std::unique_ptr<::mlir::Region> region;
|
||||
auto firstRegionResult = parser.parseOptionalRegion(region);
|
||||
if (firstRegionResult.hasValue()) {
|
||||
if (firstRegionResult.has_value()) {
|
||||
if (failed(*firstRegionResult))
|
||||
return ::mlir::failure();
|
||||
{0}Regions.emplace_back(std::move(region));
|
||||
|
@ -622,7 +622,7 @@ const char *regionListEnsureSingleBlockParserCode = R"(
|
|||
const char *optionalRegionParserCode = R"(
|
||||
{
|
||||
auto parseResult = parser.parseOptionalRegion(*{0}Region);
|
||||
if (parseResult.hasValue() && failed(*parseResult))
|
||||
if (parseResult.has_value() && failed(*parseResult))
|
||||
return ::mlir::failure();
|
||||
}
|
||||
)";
|
||||
|
@ -656,7 +656,7 @@ const char *successorListParserCode = R"(
|
|||
{
|
||||
::mlir::Block *succ;
|
||||
auto firstSucc = parser.parseOptionalSuccessor(succ);
|
||||
if (firstSucc.hasValue()) {
|
||||
if (firstSucc.has_value()) {
|
||||
if (failed(*firstSucc))
|
||||
return ::mlir::failure();
|
||||
{0}Successors.emplace_back(succ);
|
||||
|
|
|
@ -224,7 +224,7 @@ static void checkNativeAccess(MLIRContext *ctx, ArrayRef<T> data,
|
|||
|
||||
// Check that we can access and iterate the data properly.
|
||||
Optional<ArrayRef<T>> attrData = attr.tryGetAsArrayRef();
|
||||
EXPECT_TRUE(attrData.hasValue());
|
||||
EXPECT_TRUE(attrData.has_value());
|
||||
EXPECT_EQ(*attrData, data);
|
||||
|
||||
// Check that we cast to this attribute when possible.
|
||||
|
|
Loading…
Reference in New Issue