diff options
Diffstat (limited to 'mlir/lib/AsmParser/Parser.cpp')
-rw-r--r-- | mlir/lib/AsmParser/Parser.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp index aad6b450ec03..c56befe7b5e2 100644 --- a/mlir/lib/AsmParser/Parser.cpp +++ b/mlir/lib/AsmParser/Parser.cpp @@ -276,7 +276,7 @@ OptionalParseResult Parser::parseOptionalInteger(APInt &result) { /// Parse a floating point value from an integer literal token. ParseResult Parser::parseFloatFromIntegerLiteral( - Optional<APFloat> &result, const Token &tok, bool isNegative, + std::optional<APFloat> &result, const Token &tok, bool isNegative, const llvm::fltSemantics &semantics, size_t typeSizeInBits) { SMLoc loc = tok.getLoc(); StringRef spelling = tok.getSpelling(); @@ -292,7 +292,7 @@ ParseResult Parser::parseFloatFromIntegerLiteral( "leading minus"); } - Optional<uint64_t> value = tok.getUInt64IntegerValue(); + std::optional<uint64_t> value = tok.getUInt64IntegerValue(); if (!value) return emitError(loc, "hexadecimal float constant out of range for type"); @@ -534,12 +534,13 @@ public: /// skip parsing that component. ParseResult parseGenericOperationAfterOpName( OperationState &result, - Optional<ArrayRef<UnresolvedOperand>> parsedOperandUseInfo = std::nullopt, - Optional<ArrayRef<Block *>> parsedSuccessors = std::nullopt, - Optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions = + std::optional<ArrayRef<UnresolvedOperand>> parsedOperandUseInfo = std::nullopt, - Optional<ArrayRef<NamedAttribute>> parsedAttributes = std::nullopt, - Optional<FunctionType> parsedFnType = std::nullopt); + std::optional<ArrayRef<Block *>> parsedSuccessors = std::nullopt, + std::optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions = + std::nullopt, + std::optional<ArrayRef<NamedAttribute>> parsedAttributes = std::nullopt, + std::optional<FunctionType> parsedFnType = std::nullopt); /// Parse an operation instance that is in the generic form and insert it at /// the provided insertion point. @@ -1250,11 +1251,11 @@ struct CleanupOpStateRegions { ParseResult OperationParser::parseGenericOperationAfterOpName( OperationState &result, - Optional<ArrayRef<UnresolvedOperand>> parsedOperandUseInfo, - Optional<ArrayRef<Block *>> parsedSuccessors, - Optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions, - Optional<ArrayRef<NamedAttribute>> parsedAttributes, - Optional<FunctionType> parsedFnType) { + std::optional<ArrayRef<UnresolvedOperand>> parsedOperandUseInfo, + std::optional<ArrayRef<Block *>> parsedSuccessors, + std::optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions, + std::optional<ArrayRef<NamedAttribute>> parsedAttributes, + std::optional<FunctionType> parsedFnType) { // Parse the operand list, if not explicitly provided. SmallVector<UnresolvedOperand, 8> opInfo; @@ -1436,7 +1437,8 @@ public: // This can happen if an attribute set during parsing is also specified in // the attribute dictionary in the assembly, or the attribute is set // multiple during parsing. - Optional<NamedAttribute> duplicate = opState.attributes.findDuplicate(); + std::optional<NamedAttribute> duplicate = + opState.attributes.findDuplicate(); if (duplicate) return emitError(getNameLoc(), "attribute '") << duplicate->getName().getValue() @@ -1455,11 +1457,11 @@ public: ParseResult parseGenericOperationAfterOpName( OperationState &result, - Optional<ArrayRef<UnresolvedOperand>> parsedUnresolvedOperands, - Optional<ArrayRef<Block *>> parsedSuccessors, - Optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions, - Optional<ArrayRef<NamedAttribute>> parsedAttributes, - Optional<FunctionType> parsedFnType) final { + std::optional<ArrayRef<UnresolvedOperand>> parsedUnresolvedOperands, + std::optional<ArrayRef<Block *>> parsedSuccessors, + std::optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions, + std::optional<ArrayRef<NamedAttribute>> parsedAttributes, + std::optional<FunctionType> parsedFnType) final { return parser.parseGenericOperationAfterOpName( result, parsedUnresolvedOperands, parsedSuccessors, parsedRegions, parsedAttributes, parsedFnType); @@ -1777,7 +1779,7 @@ public: /// Parse a loc(...) specifier if present, filling in result if so. ParseResult - parseOptionalLocationSpecifier(Optional<Location> &result) override { + parseOptionalLocationSpecifier(std::optional<Location> &result) override { // If there is a 'loc' we parse a trailing location. if (!parser.consumeIf(Token::kw_loc)) return success(); @@ -1825,7 +1827,7 @@ FailureOr<OperationName> OperationParser::parseCustomOperationName() { consumeToken(); // Check to see if this operation name is already registered. - Optional<RegisteredOperationName> opInfo = + std::optional<RegisteredOperationName> opInfo = RegisteredOperationName::lookup(opName, getContext()); if (opInfo) return *opInfo; @@ -2395,7 +2397,7 @@ public: // Blob data within then textual format is represented as a hex string. // TODO: We could avoid an additional alloc+copy here if we pre-allocated // the buffer to use during hex processing. - Optional<std::string> blobData = + std::optional<std::string> blobData = value.is(Token::string) ? value.getHexStringValue() : std::nullopt; if (!blobData) return p.emitError(value.getLoc(), |