This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add has_value and value to OptionalParseResult
ClosedPublic

Authored by kazu on Jul 30 2022, 12:32 AM.

Details

Summary

llvm::Optional is in the process of switching to the
std::optional-like interface with has_value/value as opposed to
hasValue/getValue.

This patch adds has_value and value to enable the same transition.

Diff Detail

Event Timeline

kazu created this revision.Jul 30 2022, 12:32 AM
kazu requested review of this revision.Jul 30 2022, 12:32 AM

I don't quite follow how changes to llvm::Optional necessitates changes to OptionalParseResult's API. llvm::Optional is an implementation detail not a user facing one.

kazu added a comment.Jul 30 2022, 11:07 AM

I don't quite follow how changes to llvm::Optional necessitates changes to OptionalParseResult's API. llvm::Optional is an implementation detail not a user facing one.

This patch is for consistency with updates to llvm::Optional so that people don't have to worry about whether to use hasValue or has_value. As you mentioned, changes to llvm::Optional do not necessitate changes to OptionalParseResult.

rriddle accepted this revision.Aug 2 2022, 11:56 AM

Seems fine I suppose to match the API of Optional.

This revision is now accepted and ready to land.Aug 2 2022, 11:56 AM
This revision was automatically updated to reflect the committed changes.