[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions
authorKirill Bobyrev <omtcyfz@gmail.com>
Mon, 26 Sep 2016 07:22:37 +0000 (07:22 +0000)
committerKirill Bobyrev <omtcyfz@gmail.com>
Mon, 26 Sep 2016 07:22:37 +0000 (07:22 +0000)
commit9559f04b9db004375b10f79e30d0e321c62ab222
tree391a2101c2711cbe552b018304e09bd12d943e34
parent839d15a194a658dfe407e1681514231455138360
[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions

This patch extends clang-tidy's readability-redundant-smartptr-get to produce
warnings for previously unsupported cases:

```
std::unique_ptr<void> ptr;
if (ptr.get())
if (ptr.get() == NULL)
if (ptr.get() != NULL)
```

This is intended to fix https://llvm.org/bugs/show_bug.cgi?id=25804, a bug
report opened by @Eugene.Zelenko.

However, there still are cases not detected by the check. They can be found in
`void Negative()` function defined in
test/clang-tidy/readability-redundant-smartptr-get.cpp.

Reviewers: alexfh

Differential Revision: https://reviews.llvm.org/D24893

llvm-svn: 282386
clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp