OSDN Git Service

[clang-tidy] Ignore a case where the fix of make_unique check introduces side effect.
authorHaojian Wu <hokein@google.com>
Thu, 18 Oct 2018 09:13:34 +0000 (09:13 +0000)
committerHaojian Wu <hokein@google.com>
Thu, 18 Oct 2018 09:13:34 +0000 (09:13 +0000)
commit547f89d607044004969f2556e1d10770917b753d
treea84dadc58e55668a8364289c0a037eeefbd8783b
parent5ee0188f2b87c7600ab2fef8f630efb75aeb57d5
[clang-tidy] Ignore a case where the fix of make_unique check introduces side effect.

Summary:
Previously, ptr.reset(new char[5]) will be replaced with `p =
make_unique<char[]>(5)`, the fix has side effect -- doing
default initialization, it may cause performace regression (we are
bitten by this rececntly)

The check should be conservative for these cases.

Reviewers: alexfh

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 344733
clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp