Open firewave opened 3 weeks ago
I think the target of two functions is totally different.
isOnlyUsedAsConst
want to detect the usage of object itself.
MutationAnalyzer
want to detect mutation of the symbol of this object.
e.g.
For symbol a
,
a = A{}
, isOnlyUsedAsConst
should not treat it as non-const usage but MutationAnalyzer
should treat it as mutation.
Weirdly, those two checks are using distinct methods to infer whether the underlying container is mutated.
unnecessary-copy-initialization
usesdoesNotMutateObject
whileperformance-unnecessary-value-param
usesFunctionParmMutationAnalyzer
.So unfortunately this change won't improve
performance-unnecessary-value-param
.I can have a look at unifying both in a subsequent PR.
Originally posted by @legrosbuffle in https://github.com/llvm/llvm-project/issues/94362#issuecomment-2149113119