[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

Shuai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 09:55:17 PDT 2018


shuaiwang added a comment.

In https://reviews.llvm.org/D50883#1203690, @JonasToth wrote:

> I am suprised that this does not automatically follow from the general rules. At the end, smartpointers cant do anything else then 'normal' classes.
>
> The `operator+/->` were not handled before? The mutation of `SmartPtr x; x->mf();` should already be catched, not?


Different from `std::vector::operator[]` which has two overloads for const and non-const access, `std::unique_ptr` only has one const version of `operator->`.
So for `SmartPtr x; x->mf();` we only see a const operator being invoked on `x`. `mf` is not a member of `SmartPtr` and the member call to `mf` is not on `x` directly, we never followed that far.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50883





More information about the cfe-commits mailing list