Skip to content

Commit 8e5f112

Browse files
committed
Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)
1 parent a68c8d3 commit 8e5f112

File tree

7 files changed

+8
-10
lines changed

7 files changed

+8
-10
lines changed

mlir/examples/toy/Ch7/include/toy/Parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ class Parser {
253253
if (args.size() != 1)
254254
return parseError<ExprAST>("<single arg>", "as argument to print()");
255255

256-
return std::make_unique<PrintExprAST>(std::move(loc), std::move(args[0]));
256+
return std::make_unique<PrintExprAST>(loc, std::move(args[0]));
257257
}
258258

259259
// Call to a user-defined function
260-
return std::make_unique<CallExprAST>(std::move(loc), std::string(name),
260+
return std::make_unique<CallExprAST>(loc, std::string(name),
261261
std::move(args));
262262
}
263263

mlir/include/mlir/ExecutionEngine/MemRefUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class OwningMemRef {
198198
DescriptorType &operator*() { return descriptor; }
199199
DescriptorType *operator->() { return &descriptor; }
200200
T &operator[](std::initializer_list<int64_t> indices) {
201-
return descriptor[std::move(indices)];
201+
return descriptor[indices];
202202
}
203203

204204
private:

mlir/include/mlir/IR/BuiltinAttributeInterfaces.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct ElementsAttrIndexer {
3838
ElementsAttrIndexer(ElementsAttrIndexer &&rhs)
3939
: isContiguous(rhs.isContiguous), isSplat(rhs.isSplat) {
4040
if (isContiguous)
41-
conState = std::move(rhs.conState);
41+
conState = rhs.conState;
4242
else
4343
new (&nonConState) NonContiguousState(std::move(rhs.nonConState));
4444
}

mlir/include/mlir/IR/BuiltinAttributes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,7 @@ auto SparseElementsAttr::value_begin() const -> iterator<T> {
900900
auto valueIt = getValues().value_begin<T>();
901901
const std::vector<ptrdiff_t> flatSparseIndices(getFlattenedSparseIndices());
902902
std::function<T(ptrdiff_t)> mapFn =
903-
[flatSparseIndices{std::move(flatSparseIndices)},
904-
valueIt{std::move(valueIt)},
903+
[flatSparseIndices{flatSparseIndices}, valueIt{std::move(valueIt)},
905904
zeroValue{std::move(zeroValue)}](ptrdiff_t index) {
906905
// Try to map the current index to one of the sparse indices.
907906
for (unsigned i = 0, e = flatSparseIndices.size(); i != e; ++i)

mlir/include/mlir/Support/Timing.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ class Timer {
228228
///
229229
/// The `nameBuilder` function is not guaranteed to be called.
230230
Timer nest(const void *id, function_ref<std::string()> nameBuilder) {
231-
return tm ? Timer(*tm, tm->nestTimer(handle, id, std::move(nameBuilder)))
232-
: Timer();
231+
return tm ? Timer(*tm, tm->nestTimer(handle, id, nameBuilder)) : Timer();
233232
}
234233

235234
/// See above.

mlir/include/mlir/TableGen/Format.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class FmtObjectBase {
152152
FmtObjectBase(const FmtObjectBase &that) = delete;
153153

154154
FmtObjectBase(FmtObjectBase &&that)
155-
: fmt(std::move(that.fmt)), context(that.context),
155+
: fmt(that.fmt), context(that.context),
156156
adapters(), // adapters are initialized by FmtObject
157157
replacements(std::move(that.replacements)) {}
158158

mlir/include/mlir/Transforms/DialectConversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ class ConversionTarget {
778778
StringRef name, Names... names) {
779779
SmallVector<StringRef, 2> dialectNames({name, names...});
780780
setDialectAction(dialectNames, LegalizationAction::Dynamic);
781-
setLegalityCallback(dialectNames, std::move(callback));
781+
setLegalityCallback(dialectNames, callback);
782782
}
783783
template <typename... Args>
784784
void addDynamicallyLegalDialect(DynamicLegalityCallbackFn callback) {

0 commit comments

Comments
 (0)