summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-06 15:20:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-06 15:20:15 +0200
commitfb2cd383f7b540b948565ef6e299a4cd5e125e2d (patch)
treea5184518fb4b8c28c8c8a0e20a2432ec60058c19 /compilerplugins
parent3510a0e2245e619a2e2518f8702686d608522cdf (diff)
Look through ExprWithCleanups etc.
Change-Id: I5c8af20a71eca245c4b2a0061dc0612a4770c8ff
Diffstat (limited to 'compilerplugins')
-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