[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer
Shuai Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 16 21:42:07 PDT 2018
shuaiwang created this revision.
shuaiwang added a reviewer: hokein.
Herald added subscribers: cfe-commits, Szelethus, a.sidorin, xazax.hun.
Herald added a reviewer: george.karpenkov.
For smart pointers like std::unique_ptr which uniquely owns the
underlying object, treat the mutation of the pointee as mutation of the
smart pointer itself.
This gives better behavior for cases like this:
void f(std::vector<std::unique_ptr<Foo>> v) { // undesirable analyze result of `v` as not mutated.
for (auto& p : v) {
p->mutate(); // only const member function `operator->` is invoked on `p`
}
}
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D50883
Files:
clang-tidy/utils/ExprMutationAnalyzer.cpp
unittests/clang-tidy/ExprMutationAnalyzerTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50883.161163.patch
Type: text/x-patch
Size: 6292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180817/8221845c/attachment-0001.bin>
More information about the cfe-commits
mailing list