Skip to content

Commit c66fcea

Browse files
committed
Cleanup registry
1 parent 5aa6da4 commit c66fcea

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
lines changed

mlir/lib/Tools/mlir-query/Matcher/Diagnostics.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,8 @@ static llvm::StringRef errorTypeToFormatString(Diagnostics::ErrorType type) {
9999
return "Incorrect argument count. (Expected = $0) != (Actual = $1)";
100100
case Diagnostics::ET_RegistryWrongArgType:
101101
return "Incorrect type for arg $0. (Expected = $1) != (Actual = $2)";
102-
case Diagnostics::ET_RegistryNotBindable:
103-
return "Matcher does not support binding.";
104102
case Diagnostics::ET_RegistryValueNotFound:
105103
return "Value not found: $0";
106-
case Diagnostics::ET_RegistryUnknownEnumWithReplace:
107-
return "Unknown value '$1' for arg $0; did you mean '$2'";
108-
case Diagnostics::ET_RegistryMatcherNoWithSupport:
109-
return "Matcher does not support with call.";
110104

111105
case Diagnostics::ET_ParserStringError:
112106
return "Error parsing string token: <$0>";
@@ -122,20 +116,10 @@ static llvm::StringRef errorTypeToFormatString(Diagnostics::ErrorType type) {
122116
return "Input value is not a matcher expression.";
123117
case Diagnostics::ET_ParserInvalidToken:
124118
return "Invalid token <$0> found when looking for a value.";
125-
case Diagnostics::ET_ParserMalformedExprNoOpenParen:
126-
return "Malformed identifier expression. Missing '('.";
127-
case Diagnostics::ET_ParserMalformedExprNoIdentifier:
128-
return "Malformed identifier expression. Missing string identifier.";
129-
case Diagnostics::ET_ParserMalformedExprNoCloseParen:
130-
return "Malformed identifier expression. Missing ')'.";
131119
case Diagnostics::ET_ParserTrailingCode:
132120
return "Unexpected end of code.";
133-
case Diagnostics::ET_ParserNumberError:
134-
return "Error parsing numeric literal: <$0>";
135121
case Diagnostics::ET_ParserOverloadedType:
136122
return "Input value has unresolved overloaded type: $0";
137-
case Diagnostics::ET_ParserMalformedChainedExpr:
138-
return "Period not followed by valid chained call.";
139123
case Diagnostics::ET_ParserFailedToBuildMatcher:
140124
return "Failed to build matcher: $0.";
141125

mlir/lib/Tools/mlir-query/Matcher/Diagnostics.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ class Diagnostics {
4848
ET_RegistryMatcherNotFound,
4949
ET_RegistryWrongArgCount,
5050
ET_RegistryWrongArgType,
51-
ET_RegistryNotBindable,
5251
ET_RegistryValueNotFound,
53-
ET_RegistryUnknownEnumWithReplace,
54-
ET_RegistryMatcherNoWithSupport,
5552

5653
ET_ParserStringError,
5754
ET_ParserNoOpenParen,
@@ -60,13 +57,8 @@ class Diagnostics {
6057
ET_ParserNoCode,
6158
ET_ParserNotAMatcher,
6259
ET_ParserInvalidToken,
63-
ET_ParserMalformedExprNoOpenParen,
64-
ET_ParserMalformedExprNoIdentifier,
65-
ET_ParserMalformedExprNoCloseParen,
6660
ET_ParserTrailingCode,
67-
ET_ParserNumberError,
6861
ET_ParserOverloadedType,
69-
ET_ParserMalformedChainedExpr,
7062
ET_ParserFailedToBuildMatcher
7163
};
7264

mlir/lib/Tools/mlir-query/Matcher/Marshallers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,13 @@ matcherMarshallFixedImpl(void (*func)(), StringRef matcherName,
176176
SourceRange nameRange, ArrayRef<ParserValue> args,
177177
Diagnostics *error, std::index_sequence<Is...>) {
178178
using FuncType = ReturnType (*)(ArgTypes...);
179+
180+
// Check if the argument count matches the expected count
179181
if (!checkArgCount(nameRange, sizeof...(ArgTypes), args, error)) {
180182
return VariantMatcher();
181183
}
182184

185+
// Check if each argument at the corresponding index has the correct type
183186
if ((... && checkArgTypeAtIndex<ArgTypes, Is>(matcherName, args, error))) {
184187
ReturnType fnPointer = reinterpret_cast<FuncType>(func)(
185188
ArgTypeTraits<ArgTypes>::get(args[Is].value)...);
@@ -205,6 +208,7 @@ template <typename ReturnType, typename... ArgTypes>
205208
std::unique_ptr<MatcherDescriptor>
206209
makeMatcherAutoMarshall(ReturnType (*func)(ArgTypes...),
207210
StringRef matcherName) {
211+
// Create a vector of argument kinds
208212
std::vector<ArgKind> argKinds = {ArgTypeTraits<ArgTypes>::getKind()...};
209213
return std::make_unique<FixedArgCountMatcherDescriptor>(
210214
matcherMarshallFixed<ReturnType, ArgTypes...>,

0 commit comments

Comments
 (0)