forked from OSchip/llvm-project
[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
This commit is contained in:
parent
15b8cd9190
commit
77c56fffad
|
@ -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.
|
||||
|
|
|
@ -341,6 +341,9 @@ void initialization(int T, Base b) {
|
|||
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::make_unique instead
|
||||
// CHECK-FIXES: PE1 = std::make_unique<E>();
|
||||
|
||||
// No warnings for `auto` new expression.
|
||||
PE1.reset(new auto(E()));
|
||||
|
||||
//============================================================================
|
||||
// NOTE: For initlializer-list constructors, the check only gives warnings,
|
||||
// and no fixes are generated.
|
||||
|
|
Loading…
Reference in New Issue