From fb2cd383f7b540b948565ef6e299a4cd5e125e2d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 6 Apr 2017 15:20:15 +0200 Subject: Look through ExprWithCleanups etc. Change-Id: I5c8af20a71eca245c4b2a0061dc0612a4770c8ff --- compilerplugins/clang/useuniqueptr.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compilerplugins/clang/useuniqueptr.cxx') 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(declRefExpr->getDecl()); if (!varDecl) return true; - if (!varDecl->hasInit() || !dyn_cast(varDecl->getInit())) + if (!varDecl->hasInit() + || !isa( + 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 -- cgit