[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Thu Apr 6 13:20:53 UTC 2017


 compilerplugins/clang/useuniqueptr.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit fb2cd383f7b540b948565ef6e299a4cd5e125e2d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 6 15:20:15 2017 +0200

    Look through ExprWithCleanups etc.
    
    Change-Id: I5c8af20a71eca245c4b2a0061dc0612a4770c8ff

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


More information about the Libreoffice-commits mailing list