Skip to content

Commit 57157a4

Browse files
committed
Address review comments
1 parent a92ca95 commit 57157a4

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

clang-tools-extra/clang-tidy/llvm/MLIROpBuilderCheck.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//===--- MLIROpBuilderCheck.cpp - clang-tidy
2-
//-------------------------------===//
1+
//===--- MLIROpBuilderCheck.cpp - clang-tidy ------------------------------===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
54
// See https://llvm.org/LICENSE.txt for license information.
@@ -32,23 +31,23 @@ class TypeAsWrittenStencil : public StencilInterface {
3231

3332
llvm::Error eval(const MatchFinder::MatchResult &match,
3433
std::string *result) const override {
35-
auto n = node(id)(match);
34+
RangeSelector n = node(id)(match);
3635
if (!n)
3736
return n.takeError();
38-
auto srcRange = n->getAsRange();
37+
SourceRange srcRange = n->getAsRange();
3938
if (srcRange.isInvalid()) {
4039
return llvm::make_error<llvm::StringError>(llvm::errc::invalid_argument,
4140
"srcRange is invalid");
4241
}
43-
auto range = n->getTokenRange(srcRange);
42+
const CharSourceRange range = n->getTokenRange(srcRange);
4443
auto nextToken = [&](std::optional<Token> token) {
4544
if (!token)
4645
return token;
4746
return clang::Lexer::findNextToken(token->getLocation(),
4847
*match.SourceManager,
4948
match.Context->getLangOpts());
5049
};
51-
auto lessToken = clang::Lexer::findNextToken(
50+
std::optional<Token> lessToken = clang::Lexer::findNextToken(
5251
range.getBegin(), *match.SourceManager, match.Context->getLangOpts());
5352
while (lessToken && lessToken->getKind() != clang::tok::less) {
5453
lessToken = nextToken(lessToken);
@@ -58,7 +57,7 @@ class TypeAsWrittenStencil : public StencilInterface {
5857
"missing '<' token");
5958
}
6059
std::optional<Token> endToken = nextToken(lessToken);
61-
for (auto greaterToken = nextToken(endToken);
60+
for (std::optional<Token> greaterToken = nextToken(endToken);
6261
greaterToken && greaterToken->getKind() != clang::tok::greater;
6362
greaterToken = nextToken(greaterToken)) {
6463
endToken = greaterToken;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ New checks
150150
Finds unscoped (non-class) ``enum`` declarations and suggests using
151151
``enum class`` instead.
152152

153+
- New :doc:`llvm-mlir-op-builder
154+
<clang-tidy/checks/llvm/mlir-op-builder>` check.
155+
156+
Flags usage of old form of invoking create on MLIR's `OpBuilder` and suggests
157+
new form.
158+
153159
- New :doc:`llvm-prefer-static-over-anonymous-namespace
154160
<clang-tidy/checks/llvm/prefer-static-over-anonymous-namespace>` check.
155161

@@ -162,11 +168,6 @@ New checks
162168
Finds uses of ``std::lock_guard`` and suggests replacing them with C++17's
163169
alternative ``std::scoped_lock``.
164170

165-
- New :doc:`llvm-mlir-op-builder
166-
<clang-tidy/checks/llvm/mlir-op-builder>` check.
167-
168-
Flags usage of old OpBuilder format.
169-
170171
- New :doc:`portability-avoid-pragma-once
171172
<clang-tidy/checks/portability/avoid-pragma-once>` check.
172173

clang-tools-extra/docs/clang-tidy/checks/llvm/mlir-op-builder.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.. title:: clang-tidy - llvm-mlir-op-builder
22

33
llvm-mlir-op-builder
4-
===============
4+
====================
55

6-
Flags usage of old form of invoking create on MLIR's `OpBuilder` and suggesting
6+
Flags usage of old form of invoking create on MLIR's `OpBuilder` and suggests
77
new form.
88

99
Example
@@ -19,4 +19,3 @@ Transforms to:
1919
.. code-block:: c++
2020

2121
FooOp::create(builder, builder.getUnknownLoc(), "baz");
22-

0 commit comments

Comments
 (0)