Skip to content

Commit 928de27

Browse files
committed
Minor cleanupv3
1 parent 28c9f99 commit 928de27

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class VariadicMatcherCreateCallback : public MatcherCreateCallback {
144144

145145
// Helper function to perform template argument deduction.
146146
template <typename MarshallerType, typename FuncType>
147-
auto createMarshallerCallback(MarshallerType Marshaller,
147+
auto *createMarshallerCallback(MarshallerType Marshaller,
148148
FuncType Func,
149149
StringRef MatcherName) {
150150
return new FixedArgCountMatcherCreateCallback<MarshallerType, FuncType>(
@@ -235,23 +235,23 @@ DynMatcher *matcherMarshall1(ReturnType (*Func)(InArgType1, InArgType2),
235235

236236
// 0-arg overload
237237
template <typename T, typename ReturnType>
238-
auto makeMatcherAutoMarshall(ReturnType (*Func)(),
238+
auto *makeMatcherAutoMarshall(ReturnType (*Func)(),
239239
StringRef MatcherName) {
240240
return createMarshallerCallback(matcherMarshall0<T, ReturnType>, Func,
241241
MatcherName);
242242
}
243243

244244
// 1-arg overload
245245
template <typename T, typename ReturnType, typename ArgType1>
246-
auto makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1),
246+
auto *makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1),
247247
StringRef MatcherName) {
248248
return createMarshallerCallback(matcherMarshall1<T, ReturnType, ArgType1>,
249249
Func, MatcherName);
250250
}
251251

252252
// 2-arg overload
253253
template <typename T, typename ReturnType, typename ArgType1, typename ArgType2>
254-
auto makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1,
254+
auto *makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1,
255255
ArgType2),
256256
StringRef MatcherName) {
257257
return createMarshallerCallback(
@@ -260,7 +260,7 @@ auto makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1,
260260

261261
// Variadic overload.
262262
template <typename T, typename MatcherType>
263-
auto makeMatcherAutoMarshall(MatcherType Func,
263+
auto *makeMatcherAutoMarshall(MatcherType Func,
264264
StringRef MatcherName) {
265265
return new VariadicMatcherCreateCallback<T>(MatcherName);
266266
}

mlir/lib/Tools/mlir-query/MatchersInternal.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class DynMatcherInterface : public llvm::RefCountedBase<DynMatcherInterface> {
5151
template <typename T>
5252
class MatcherInterface : public DynMatcherInterface {
5353
public:
54-
// Returns true if 'Node' can be matched.
5554
virtual bool matches(T Node) = 0;
5655

5756
bool dynMatches(DynTypedNode &DynNode) override {
@@ -73,14 +72,8 @@ class DynMatcher {
7372
RestrictKind(SupportedKind), Implementation(Implementation),
7473
ExtractFunction(false) {}
7574

76-
// Returns true if the matcher matches the given op.
7775
bool matches(DynTypedNode &DynNode) const {
78-
if (RestrictKind.isSame(DynNode.getNodeKind()) &&
79-
Implementation->dynMatches(DynNode)) {
80-
return true;
81-
}
82-
83-
return false;
76+
return RestrictKind.isSame(DynNode.getNodeKind()) && Implementation->dynMatches(DynNode);
8477
}
8578

8679
DynMatcher *clone() const { return new DynMatcher(*this); }
@@ -105,7 +98,7 @@ template <typename T>
10598
class Matcher {
10699
public:
107100
// Takes ownership of the provided implementation pointer.
108-
explicit Matcher(MatcherInterface<T> *Implementation)
101+
Matcher(MatcherInterface<T> *Implementation)
109102
: Implementation(Implementation) {}
110103

111104
// Forwards the call to the underlying MatcherInterface<T> pointer.

mlir/lib/Tools/mlir-query/Parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class Parser::CodeTokenizer {
177177
}
178178
}
179179

180-
Result->Text = Code.substr(0, Length);
180+
Result->Text = Code.take_front(Length);
181181
Code = Code.drop_front(Length);
182182

183183
if (isFloatingLiteral) {

0 commit comments

Comments
 (0)