1
- // ===--- MLIROpBuilderCheck.cpp - clang-tidy
2
- // -------------------------------===//
1
+ // ===--- MLIROpBuilderCheck.cpp - clang-tidy ------------------------------===//
3
2
//
4
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
4
// See https://llvm.org/LICENSE.txt for license information.
@@ -32,23 +31,23 @@ class TypeAsWrittenStencil : public StencilInterface {
32
31
33
32
llvm::Error eval (const MatchFinder::MatchResult &match,
34
33
std::string *result) const override {
35
- auto n = node (id)(match);
34
+ RangeSelector n = node (id)(match);
36
35
if (!n)
37
36
return n.takeError ();
38
- auto srcRange = n->getAsRange ();
37
+ SourceRange srcRange = n->getAsRange ();
39
38
if (srcRange.isInvalid ()) {
40
39
return llvm::make_error<llvm::StringError>(llvm::errc::invalid_argument,
41
40
" srcRange is invalid" );
42
41
}
43
- auto range = n->getTokenRange (srcRange);
42
+ const CharSourceRange range = n->getTokenRange (srcRange);
44
43
auto nextToken = [&](std::optional<Token> token) {
45
44
if (!token)
46
45
return token;
47
46
return clang::Lexer::findNextToken (token->getLocation (),
48
47
*match.SourceManager ,
49
48
match.Context ->getLangOpts ());
50
49
};
51
- auto lessToken = clang::Lexer::findNextToken (
50
+ std::optional<Token> lessToken = clang::Lexer::findNextToken (
52
51
range.getBegin (), *match.SourceManager , match.Context ->getLangOpts ());
53
52
while (lessToken && lessToken->getKind () != clang::tok::less) {
54
53
lessToken = nextToken (lessToken);
@@ -58,7 +57,7 @@ class TypeAsWrittenStencil : public StencilInterface {
58
57
" missing '<' token" );
59
58
}
60
59
std::optional<Token> endToken = nextToken (lessToken);
61
- for (auto greaterToken = nextToken (endToken);
60
+ for (std::optional<Token> greaterToken = nextToken (endToken);
62
61
greaterToken && greaterToken->getKind () != clang::tok::greater;
63
62
greaterToken = nextToken (greaterToken)) {
64
63
endToken = greaterToken;
0 commit comments