[PATCH] D103087: [clang-tidy] performances-unnecessary-* checks: Extend isOnlyUsedAsConst to expressions and catch const methods returning non-const references/pointers.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 2 07:49:24 PDT 2021
ymandel added a comment.
I have some concerns about the cost of this checks as it used matching over entire contexts quite extensively. At this point, the facilities involved seem quite close to doing dataflow analysis and I wonder if you might be better off with a very different implementation. Regardless, have you done any perfomance testing to see the impact on real code?
================
Comment at: clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.h:30
+// Returns true if expression is only used in a const compatible fashion.
+bool isOnlyUsedAsConst(const Expr &E, const Stmt &Stmt, ASTContext &Context);
----------------
please expand this comment. It's not obvious (to me) what it means for a variable to be used in a "const compatible fashion".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103087/new/
https://reviews.llvm.org/D103087
More information about the cfe-commits
mailing list