https://github.com/segoon updated https://github.com/llvm/llvm-project/pull/139525
>From 3abbce9f817f6d09f9a5b7549a8122c80821eaf8 Mon Sep 17 00:00:00 2001 From: Vasily Kulikov <seg...@yandex-team.ru> Date: Mon, 12 May 2025 13:05:43 +0300 Subject: [PATCH 1/6] [clang-tidy] Add check performance-lost-std-move --- .../clang-tidy/performance/CMakeLists.txt | 1 + .../performance/LostStdMoveCheck.cpp | 96 ++++++++++++++++ .../clang-tidy/performance/LostStdMoveCheck.h | 37 ++++++ .../performance/PerformanceTidyModule.cpp | 2 + clang-tools-extra/docs/ReleaseNotes.rst | 5 + .../docs/clang-tidy/checks/list.rst | 1 + .../checks/performance/lost-std-move.rst | 14 +++ .../checkers/performance/lost-std-move.cpp | 108 ++++++++++++++++++ 8 files changed, 264 insertions(+) create mode 100644 clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp create mode 100644 clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.h create mode 100644 clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst create mode 100644 clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp diff --git a/clang-tools-extra/clang-tidy/performance/CMakeLists.txt b/clang-tools-extra/clang-tidy/performance/CMakeLists.txt index 81128ff086021..333abd10a583a 100644 --- a/clang-tools-extra/clang-tidy/performance/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/performance/CMakeLists.txt @@ -12,6 +12,7 @@ add_clang_library(clangTidyPerformanceModule InefficientAlgorithmCheck.cpp InefficientStringConcatenationCheck.cpp InefficientVectorOperationCheck.cpp + LostStdMoveCheck.cpp MoveConstArgCheck.cpp MoveConstructorInitCheck.cpp NoAutomaticMoveCheck.cpp diff --git a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp new file mode 100644 index 0000000000000..26148e1d26de9 --- /dev/null +++ b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp @@ -0,0 +1,96 @@ +//===--- LostStdMoveCheck.cpp - clang-tidy --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "LostStdMoveCheck.h" +#include "../utils/DeclRefExprUtils.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang::tidy::performance { + +using utils::decl_ref_expr::allDeclRefExprs; + +AST_MATCHER(CXXRecordDecl, hasTrivialMoveConstructor) { + return Node.hasDefinition() && Node.hasTrivialMoveConstructor(); +} + +void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) { + auto returnParent = + hasParent(expr(hasParent(cxxConstructExpr(hasParent(returnStmt()))))); + + Finder->addMatcher( + declRefExpr( + // not "return x;" + unless(returnParent), + + unless(hasType(namedDecl(hasName("::std::string_view")))), + + // non-trivial type + hasType(hasCanonicalType(hasDeclaration(cxxRecordDecl()))), + + // non-trivial X(X&&) + unless(hasType(hasCanonicalType( + hasDeclaration(cxxRecordDecl(hasTrivialMoveConstructor()))))), + + // Not in a cycle + unless(hasAncestor(forStmt())), unless(hasAncestor(doStmt())), + unless(hasAncestor(whileStmt())), + + // only non-X& + unless(hasDeclaration( + varDecl(hasType(qualType(lValueReferenceType()))))), + + hasDeclaration( + varDecl(hasAncestor(functionDecl().bind("func"))).bind("decl")), + + hasParent(expr(hasParent(cxxConstructExpr())).bind("use_parent"))) + .bind("use"), + this); +} + +const Expr *LostStdMoveCheck::getLastVarUsage(const VarDecl &Var, + const Decl &Func, + ASTContext &Context) { + auto Exprs = allDeclRefExprs(Var, Func, Context); + + const Expr *LastExpr = nullptr; + for (const auto &Expr : Exprs) { + if (!LastExpr) + LastExpr = Expr; + + if (LastExpr->getBeginLoc() < Expr->getBeginLoc()) + LastExpr = Expr; + } + + return LastExpr; +} + +void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) { + const auto *MatchedDecl = Result.Nodes.getNodeAs<VarDecl>("decl"); + const auto *MatchedFunc = Result.Nodes.getNodeAs<FunctionDecl>("func"); + const auto *MatchedUse = Result.Nodes.getNodeAs<Expr>("use"); + const auto *MatchedUseCall = Result.Nodes.getNodeAs<CallExpr>("use_parent"); + + if (MatchedUseCall) + return; + + const auto *LastUsage = + getLastVarUsage(*MatchedDecl, *MatchedFunc, *Result.Context); + if (LastUsage == nullptr) + return; + + if (LastUsage->getBeginLoc() > MatchedUse->getBeginLoc()) { + // "use" is not the last reference to x + return; + } + + diag(LastUsage->getBeginLoc(), "Could be std::move()"); +} + +} // namespace clang::tidy::performance diff --git a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.h b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.h new file mode 100644 index 0000000000000..c62c3f6448a82 --- /dev/null +++ b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.h @@ -0,0 +1,37 @@ +//===--- LostStdMoveCheck.h - clang-tidy ------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_LOSTSTDMOVECHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_LOSTSTDMOVECHECK_H + +#include "../ClangTidyCheck.h" + +namespace clang::tidy::performance { + +/// Search for lost std::move(). +/// +/// For the user-facing documentation see: +/// http://clang.llvm.org/extra/clang-tidy/checks/performance/lost-std-move.html +class LostStdMoveCheck : public ClangTidyCheck { +public: + LostStdMoveCheck(StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context) {} + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; + bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { + return LangOpts.CPlusPlus; + } + +private: + const Expr *getLastVarUsage(const VarDecl &Var, const Decl &Func, + ASTContext &Context); +}; + +} // namespace clang::tidy::performance + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_LOSTSTDMOVECHECK_H diff --git a/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp b/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp index 9e0fa6f88b36a..6c45f8678fe63 100644 --- a/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp @@ -17,6 +17,7 @@ #include "InefficientAlgorithmCheck.h" #include "InefficientStringConcatenationCheck.h" #include "InefficientVectorOperationCheck.h" +#include "LostStdMoveCheck.h" #include "MoveConstArgCheck.h" #include "MoveConstructorInitCheck.h" #include "NoAutomaticMoveCheck.h" @@ -49,6 +50,7 @@ class PerformanceModule : public ClangTidyModule { "performance-inefficient-string-concatenation"); CheckFactories.registerCheck<InefficientVectorOperationCheck>( "performance-inefficient-vector-operation"); + CheckFactories.registerCheck<LostStdMoveCheck>("performance-lost-std-move"); CheckFactories.registerCheck<MoveConstArgCheck>( "performance-move-const-arg"); CheckFactories.registerCheck<MoveConstructorInitCheck>( diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 6d91748e4cef1..17da163ff041c 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -212,6 +212,11 @@ New checks Recommends the smallest possible underlying type for an ``enum`` or ``enum`` class based on the range of its enumerators. +- New :doc:`performance-lost-std-move + <clang-tidy/checks/performance/lost-std-move>` check. + + Searches for lost std::move(). + - New :doc:`readability-reference-to-constructed-temporary <clang-tidy/checks/readability/reference-to-constructed-temporary>` check. diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index 31f0e090db1d7..2eba4aacb2c33 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -321,6 +321,7 @@ Clang-Tidy Checks :doc:`performance-inefficient-algorithm <performance/inefficient-algorithm>`, "Yes" :doc:`performance-inefficient-string-concatenation <performance/inefficient-string-concatenation>`, :doc:`performance-inefficient-vector-operation <performance/inefficient-vector-operation>`, "Yes" + :doc:`performance-lost-std-move <performance/lost-std-move>`, "Yes" :doc:`performance-move-const-arg <performance/move-const-arg>`, "Yes" :doc:`performance-move-constructor-init <performance/move-constructor-init>`, :doc:`performance-no-automatic-move <performance/no-automatic-move>`, diff --git a/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst b/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst new file mode 100644 index 0000000000000..ded49de7b8126 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst @@ -0,0 +1,14 @@ +.. title:: clang-tidy - performance-lost-std-move + +performance-lost-std-move +========================= + +The check warns if copy constructor is used instead of std::move(). + +.. code-block:: c++ + + void f(X); + + void g(X x) { + f(x); // warning: Could be std::move() [performance-lost-std-move] + } diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp new file mode 100644 index 0000000000000..ce2d1b972dbd5 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp @@ -0,0 +1,108 @@ +// RUN: %check_clang_tidy %s performance-lost-std-move %t + +namespace std { + +template<typename T> +class shared_ptr { +public: + T& operator*() { return reinterpret_cast<T&>(*this); } + shared_ptr() {} + shared_ptr(const shared_ptr<T>&) {} +}; + +template<typename T> +T&& move(T&) +{ +} + +} // namespace std + +int f(std::shared_ptr<int>); + +void f_arg(std::shared_ptr<int> ptr) +{ + if (*ptr) + f(ptr); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: Could be std::move() [performance-lost-std-move] +} + +void f_rvalue_ref(std::shared_ptr<int>&& ptr) +{ + if (*ptr) + f(ptr); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: Could be std::move() [performance-lost-std-move] +} + +using SharedPtr = std::shared_ptr<int>; +void f_using(SharedPtr ptr) +{ + if (*ptr) + f(ptr); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: Could be std::move() [performance-lost-std-move] +} + +void f_local() +{ + std::shared_ptr<int> ptr; + if (*ptr) + f(ptr); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: Could be std::move() [performance-lost-std-move] +} + +void f_move() +{ + std::shared_ptr<int> ptr; + if (*ptr) + f(std::move(ptr)); +} + +void f_ref(std::shared_ptr<int> &ptr) +{ + if (*ptr) + f(ptr); +} + +std::shared_ptr<int> f_return() +{ + std::shared_ptr<int> ptr; + return ptr; +} + +void f_still_used(std::shared_ptr<int> ptr) +{ + if (*ptr) + f(ptr); + + *ptr = 1; + *ptr = *ptr; +} + +void f_cycle1() +{ + std::shared_ptr<int> ptr; + for(;;) + f(ptr); +} + +void f_cycle2() +{ + std::shared_ptr<int> ptr; + for(int i=0; i<5; i++) + f(ptr); +} + +void f_cycle3() +{ + std::shared_ptr<int> ptr; + while (*ptr) { + f(ptr); + } +} + +void f_cycle4() +{ + std::shared_ptr<int> ptr; + do { + f(ptr); + } while (*ptr); +} >From b48a1f7d51f43a88e9efd16aad316e7c718ae58a Mon Sep 17 00:00:00 2001 From: Vasily Kulikov <seg...@yandex-team.ru> Date: Mon, 12 May 2025 15:20:04 +0300 Subject: [PATCH 2/6] f(x, x) --- .../performance/LostStdMoveCheck.cpp | 22 +++++++++++++++++++ .../checkers/performance/lost-std-move.cpp | 6 +++++ 2 files changed, 28 insertions(+) diff --git a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp index 26148e1d26de9..228d654b39aef 100644 --- a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp @@ -24,6 +24,9 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) { auto returnParent = hasParent(expr(hasParent(cxxConstructExpr(hasParent(returnStmt()))))); + auto outermostExpr = expr(unless(hasParent(expr()))); + auto leafStatement = stmt(outermostExpr, unless(hasDescendant(outermostExpr))); + Finder->addMatcher( declRefExpr( // not "return x;" @@ -46,6 +49,8 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) { unless(hasDeclaration( varDecl(hasType(qualType(lValueReferenceType()))))), + hasAncestor(leafStatement.bind("leaf_statement")), + hasDeclaration( varDecl(hasAncestor(functionDecl().bind("func"))).bind("decl")), @@ -71,11 +76,19 @@ const Expr *LostStdMoveCheck::getLastVarUsage(const VarDecl &Var, return LastExpr; } +template <typename Node> +void extractNodesByIdTo(ArrayRef<BoundNodes> Matches, StringRef ID, + llvm::SmallPtrSet<const Node *, 16> &Nodes) { + for (const auto &Match : Matches) + Nodes.insert(Match.getNodeAs<Node>(ID)); +} + void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) { const auto *MatchedDecl = Result.Nodes.getNodeAs<VarDecl>("decl"); const auto *MatchedFunc = Result.Nodes.getNodeAs<FunctionDecl>("func"); const auto *MatchedUse = Result.Nodes.getNodeAs<Expr>("use"); const auto *MatchedUseCall = Result.Nodes.getNodeAs<CallExpr>("use_parent"); + const auto *MatchedLeafStatement = Result.Nodes.getNodeAs<Stmt>("leaf_statement"); if (MatchedUseCall) return; @@ -90,6 +103,15 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) { return; } + // Calculate X usage count in the statement + llvm::SmallPtrSet<const DeclRefExpr *, 16> DeclRefs; + auto Matches = match(findAll(declRefExpr(to(varDecl(equalsNode(MatchedDecl)))).bind("ref")), *MatchedLeafStatement, *Result.Context); + extractNodesByIdTo(Matches, "ref", DeclRefs); + if (DeclRefs.size() > 1) { + // Unspecified order of evaluation, e.g. f(x, x) + return; + } + diag(LastUsage->getBeginLoc(), "Could be std::move()"); } diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp index ce2d1b972dbd5..a4a2550971cac 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move.cpp @@ -106,3 +106,9 @@ void f_cycle4() f(ptr); } while (*ptr); } + +int f_multiple_usages() +{ + std::shared_ptr<int> ptr; + return f(ptr) + f(ptr); +} >From 32ebfed941f16cecaa3fb03b867c10461388f320 Mon Sep 17 00:00:00 2001 From: Vasily Kulikov <seg...@yandex-team.ru> Date: Mon, 12 May 2025 15:25:26 +0300 Subject: [PATCH 3/6] format --- .../clang-tidy/performance/LostStdMoveCheck.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp index 228d654b39aef..787580deddd05 100644 --- a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp @@ -25,7 +25,8 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) { hasParent(expr(hasParent(cxxConstructExpr(hasParent(returnStmt()))))); auto outermostExpr = expr(unless(hasParent(expr()))); - auto leafStatement = stmt(outermostExpr, unless(hasDescendant(outermostExpr))); + auto leafStatement = + stmt(outermostExpr, unless(hasDescendant(outermostExpr))); Finder->addMatcher( declRefExpr( @@ -49,7 +50,7 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) { unless(hasDeclaration( varDecl(hasType(qualType(lValueReferenceType()))))), - hasAncestor(leafStatement.bind("leaf_statement")), + hasAncestor(leafStatement.bind("leaf_statement")), hasDeclaration( varDecl(hasAncestor(functionDecl().bind("func"))).bind("decl")), @@ -88,7 +89,8 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) { const auto *MatchedFunc = Result.Nodes.getNodeAs<FunctionDecl>("func"); const auto *MatchedUse = Result.Nodes.getNodeAs<Expr>("use"); const auto *MatchedUseCall = Result.Nodes.getNodeAs<CallExpr>("use_parent"); - const auto *MatchedLeafStatement = Result.Nodes.getNodeAs<Stmt>("leaf_statement"); + const auto *MatchedLeafStatement = + Result.Nodes.getNodeAs<Stmt>("leaf_statement"); if (MatchedUseCall) return; @@ -105,7 +107,9 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) { // Calculate X usage count in the statement llvm::SmallPtrSet<const DeclRefExpr *, 16> DeclRefs; - auto Matches = match(findAll(declRefExpr(to(varDecl(equalsNode(MatchedDecl)))).bind("ref")), *MatchedLeafStatement, *Result.Context); + auto Matches = match( + findAll(declRefExpr(to(varDecl(equalsNode(MatchedDecl)))).bind("ref")), + *MatchedLeafStatement, *Result.Context); extractNodesByIdTo(Matches, "ref", DeclRefs); if (DeclRefs.size() > 1) { // Unspecified order of evaluation, e.g. f(x, x) >From f526417a80e84866b42ec5b67d839cc6963aca62 Mon Sep 17 00:00:00 2001 From: Vasily Kulikov <seg...@yandex-team.ru> Date: Mon, 12 May 2025 18:05:39 +0300 Subject: [PATCH 4/6] fixes --- clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp | 4 ++-- clang-tools-extra/docs/ReleaseNotes.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp index 787580deddd05..fca0f751bbd0a 100644 --- a/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp @@ -63,7 +63,7 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) { const Expr *LostStdMoveCheck::getLastVarUsage(const VarDecl &Var, const Decl &Func, ASTContext &Context) { - auto Exprs = allDeclRefExprs(Var, Func, Context); + llvm::SmallPtrSet<const DeclRefExpr *, 16> Exprs = allDeclRefExprs(Var, Func, Context); const Expr *LastExpr = nullptr; for (const auto &Expr : Exprs) { @@ -95,7 +95,7 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) { if (MatchedUseCall) return; - const auto *LastUsage = + const Expr *LastUsage = getLastVarUsage(*MatchedDecl, *MatchedFunc, *Result.Context); if (LastUsage == nullptr) return; diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index e95d6cda2d98f..740ea19ceaed1 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -133,7 +133,7 @@ New checks - New :doc:`performance-lost-std-move <clang-tidy/checks/performance/lost-std-move>` check. - Searches for lost std::move(). + Searches for lost ``std::move()``. - New :doc:`readability-ambiguous-smartptr-reset-call <clang-tidy/checks/readability/ambiguous-smartptr-reset-call>` check. >From 13c14334b6683019c700acd5fa6ba04250868ce6 Mon Sep 17 00:00:00 2001 From: Vasily Kulikov <seg...@yandex-team.ru> Date: Mon, 12 May 2025 18:06:43 +0300 Subject: [PATCH 5/6] cleanup --- clang-tools-extra/docs/ReleaseNotes.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 740ea19ceaed1..6179e8f16cd95 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -138,7 +138,6 @@ New checks - New :doc:`readability-ambiguous-smartptr-reset-call <clang-tidy/checks/readability/ambiguous-smartptr-reset-call>` check. - Finds potentially erroneous calls to ``reset`` method on smart pointers when the pointee type also has a ``reset`` method. >From d3b8c17f54976765de802b25df6df83a1af95723 Mon Sep 17 00:00:00 2001 From: Vasily Kulikov <seg...@yandex-team.ru> Date: Mon, 12 May 2025 18:13:29 +0300 Subject: [PATCH 6/6] sync --- clang-tools-extra/docs/ReleaseNotes.rst | 2 +- .../docs/clang-tidy/checks/performance/lost-std-move.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 6179e8f16cd95..6a7122a4ba9e0 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -133,7 +133,7 @@ New checks - New :doc:`performance-lost-std-move <clang-tidy/checks/performance/lost-std-move>` check. - Searches for lost ``std::move()``. + Warns if copy constructor is used instead of ``std::move()``. - New :doc:`readability-ambiguous-smartptr-reset-call <clang-tidy/checks/readability/ambiguous-smartptr-reset-call>` check. diff --git a/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst b/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst index ded49de7b8126..9891c3fee1b63 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst @@ -3,7 +3,7 @@ performance-lost-std-move ========================= -The check warns if copy constructor is used instead of std::move(). +Warns if copy constructor is used instead of ``std::move()``. .. code-block:: c++ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits