@@ -122,6 +122,12 @@ struct ParseInstructionInfo {
122
122
: AsmRewrites(rewrites) {}
123
123
};
124
124
125
+ enum OperandMatchResultTy {
126
+ MatchOperand_Success, // operand matched successfully
127
+ MatchOperand_NoMatch, // operand did not match
128
+ MatchOperand_ParseFail // operand matched but had errors
129
+ };
130
+
125
131
// / Ternary parse status returned by various parse* methods.
126
132
class ParseStatus {
127
133
enum class StatusTy { Success, Failure, NoMatch } Status;
@@ -146,12 +152,17 @@ class ParseStatus {
146
152
constexpr bool isSuccess () const { return Status == StatusTy::Success; }
147
153
constexpr bool isFailure () const { return Status == StatusTy::Failure; }
148
154
constexpr bool isNoMatch () const { return Status == StatusTy::NoMatch; }
149
- };
150
155
151
- enum OperandMatchResultTy {
152
- MatchOperand_Success, // operand matched successfully
153
- MatchOperand_NoMatch, // operand did not match
154
- MatchOperand_ParseFail // operand matched but had errors
156
+ // Allow implicit conversions to / from OperandMatchResultTy.
157
+ constexpr ParseStatus (OperandMatchResultTy R)
158
+ : Status(R == MatchOperand_Success ? Success
159
+ : R == MatchOperand_ParseFail ? Failure
160
+ : NoMatch) {}
161
+ constexpr operator OperandMatchResultTy () const {
162
+ return isSuccess () ? MatchOperand_Success
163
+ : isFailure () ? MatchOperand_ParseFail
164
+ : MatchOperand_NoMatch;
165
+ }
155
166
};
156
167
157
168
enum class DiagnosticPredicateTy {
0 commit comments