summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/useuniqueptr.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index a76f65d85afa..ca568c4bf2ef 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -160,7 +160,9 @@ bool UseUniquePtr::VisitCompoundStmt(const CompoundStmt* compoundStmt)
auto varDecl = dyn_cast<VarDecl>(declRefExpr->getDecl());
if (!varDecl)
return true;
- if (!varDecl->hasInit() || !dyn_cast<CXXNewExpr>(varDecl->getInit()))
+ if (!varDecl->hasInit()
+ || !isa<CXXNewExpr>(
+ varDecl->getInit()->IgnoreImplicit()->IgnoreParenImpCasts()))
return true;
// determine if the var is declared inside the same block as the delete.
// @TODO there should surely be a better way to do this