[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
Mon Jun 14 09:58:24 PDT 2021
ymandel added a comment.
In D103087#2813901 <https://reviews.llvm.org/D103087#2813901>, @flx wrote:
> In D103087#2793673 <https://reviews.llvm.org/D103087#2793673>, @ymandel wrote:
>
>> 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?
>
> That's a fair point. Is there prior art in terms of dataflow analysis in ClangTidy or LLVM I could take a look at?
Added Dmitri to speak to prior art.
> In terms of measuring performance, do you have suggestions how to measure this? I can add a counter that counts the recursion depth that is reached to see how often this happens in practice.
I would simply run clang-tidy over a reasonable size set of files and see the timing w/ and w/o this change. But, I think that clang-tidy may have some built-in perf monitoring as well (specifically, a way to display the cost of each check, or the top most costly ones).
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