[PATCH] D124918: [clang-tidy] Add a new check for non-trivial unused variables.
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 4 07:22:21 PDT 2022
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/performance/UnusedNoSideEffectCheck.cpp:11
+
+#include <map>
+#include <sstream>
----------------
C++ headers should be after application's ones.
================
Comment at: clang-tools-extra/clang-tidy/performance/UnusedNoSideEffectCheck.cpp:116
+ CalleesForStmts[CurrentExprOrDeclStmt].insert(Callee);
+ auto *CXXMethod = dyn_cast<CXXMethodDecl>(Callee);
+ if (!CXXMethod || CXXMethod->isStatic()) {
----------------
`const auto *`. Same in other places.
================
Comment at: clang-tools-extra/clang-tidy/performance/UnusedNoSideEffectCheck.h:12
+
+#include <string>
+
----------------
C++ headers should be after application's ones.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:8
+
+A variable is defined to be side-effect-free and unused if
+
----------------
Missing colon?
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:10
+
+- It has a side-effect-free type (defined below)
+- It is not passed to a function that reads its content and whose result is used
----------------
Missing period. Same in other places.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:15
+
+- A type with a base class specified in TypesByBase
+- A type listed in RawTypes
----------------
Please highlight `TypesByBase` with single back-ticks. Same for other elements of JSON.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:27
+
+- It is a method of the explicitly listed types and the argument is `this`,
+ except:
----------------
Please use double back-ticks for language constructs like `this`.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:30
+
+ - The exceptions associated with the type (eg. std::vector::swap).
+ - A constructor of a smart pointer type that takes a non-newly-allocated
----------------
Please highlight `std::vector::swap` with double back-ticks.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124918/new/
https://reviews.llvm.org/D124918
More information about the cfe-commits
mailing list