Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)

This commit is contained in:
Mehdi Amini 2022-01-14 01:35:44 +00:00
parent a68c8d3009
commit 8e5f112c05
7 changed files with 8 additions and 10 deletions

View File

@ -253,11 +253,11 @@ private:
if (args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
return std::make_unique<PrintExprAST>(std::move(loc), std::move(args[0]));
return std::make_unique<PrintExprAST>(loc, std::move(args[0]));
}
// Call to a user-defined function
return std::make_unique<CallExprAST>(std::move(loc), std::string(name),
return std::make_unique<CallExprAST>(loc, std::string(name),
std::move(args));
}

View File

@ -198,7 +198,7 @@ public:
DescriptorType &operator*() { return descriptor; }
DescriptorType *operator->() { return &descriptor; }
T &operator[](std::initializer_list<int64_t> indices) {
return descriptor[std::move(indices)];
return descriptor[indices];
}
private:

View File

@ -38,7 +38,7 @@ public:
ElementsAttrIndexer(ElementsAttrIndexer &&rhs)
: isContiguous(rhs.isContiguous), isSplat(rhs.isSplat) {
if (isContiguous)
conState = std::move(rhs.conState);
conState = rhs.conState;
else
new (&nonConState) NonContiguousState(std::move(rhs.nonConState));
}

View File

@ -900,8 +900,7 @@ auto SparseElementsAttr::value_begin() const -> iterator<T> {
auto valueIt = getValues().value_begin<T>();
const std::vector<ptrdiff_t> flatSparseIndices(getFlattenedSparseIndices());
std::function<T(ptrdiff_t)> mapFn =
[flatSparseIndices{std::move(flatSparseIndices)},
valueIt{std::move(valueIt)},
[flatSparseIndices{flatSparseIndices}, valueIt{std::move(valueIt)},
zeroValue{std::move(zeroValue)}](ptrdiff_t index) {
// Try to map the current index to one of the sparse indices.
for (unsigned i = 0, e = flatSparseIndices.size(); i != e; ++i)

View File

@ -228,8 +228,7 @@ public:
///
/// The `nameBuilder` function is not guaranteed to be called.
Timer nest(const void *id, function_ref<std::string()> nameBuilder) {
return tm ? Timer(*tm, tm->nestTimer(handle, id, std::move(nameBuilder)))
: Timer();
return tm ? Timer(*tm, tm->nestTimer(handle, id, nameBuilder)) : Timer();
}
/// See above.

View File

@ -152,7 +152,7 @@ public:
FmtObjectBase(const FmtObjectBase &that) = delete;
FmtObjectBase(FmtObjectBase &&that)
: fmt(std::move(that.fmt)), context(that.context),
: fmt(that.fmt), context(that.context),
adapters(), // adapters are initialized by FmtObject
replacements(std::move(that.replacements)) {}

View File

@ -778,7 +778,7 @@ public:
StringRef name, Names... names) {
SmallVector<StringRef, 2> dialectNames({name, names...});
setDialectAction(dialectNames, LegalizationAction::Dynamic);
setLegalityCallback(dialectNames, std::move(callback));
setLegalityCallback(dialectNames, callback);
}
template <typename... Args>
void addDynamicallyLegalDialect(DynamicLegalityCallbackFn callback) {