diff options
| author | Haojian Wu <hokein@google.com> | 2018-11-26 12:42:08 +0000 |
|---|---|---|
| committer | Haojian Wu <hokein@google.com> | 2018-11-26 12:42:08 +0000 |
| commit | 77c56fffadacefcced1155a7490738ab1253b728 (patch) | |
| tree | 2aa1ef3684662bba0348261b7b1fd7d0e21be8e9 /clang-tools-extra/clang-tidy/modernize | |
| parent | 15b8cd919033a78a55256b2e7cda81de2b29c2e0 (diff) | |
| download | bcm5719-llvm-77c56fffadacefcced1155a7490738ab1253b728.tar.gz bcm5719-llvm-77c56fffadacefcced1155a7490738ab1253b728.zip | |
[clang-tidy] No warning for auto new expression in smart check
Summary: The fix for `auto` new expression is illegal.
Reviewers: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54832
llvm-svn: 347551
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp index c8d66cadd6d..15b88b8b353 100644 --- a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp @@ -120,6 +120,9 @@ void MakeSmartPtrCheck::check(const MatchFinder::MatchResult &Result) { if (New->getNumPlacementArgs() != 0) return; + // Skip when this is a new-expression with `auto`, e.g. new auto(1) + if (New->getType()->getPointeeType()->getContainedAutoType()) + return; // Be conservative for cases where we construct an array without any // initalization. |

