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

New commits:
commit 5688cd1d9ad4500b82d2668cc5035da5c64acd0e
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Oct 8 14:10:17 2018 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Oct 8 16:58:44 2018 +0200

    Fix loplugin:useuniqueptr for libc++ (macOS)
    
    ...after 05a337e297eb0cfe88c99503d760bd9eaf495b7d "loplugin:useuniqueptr 
look
    for deleting in loops with iterators", where it didn't emit the warning for
    Foo24 in compilerplugins/clang/test/useuniqueptr.cxx during
    CompilerTest_compilerplugins_clang, because in the initialization of
    
      HTMLAttrs::const_iterator it = m_aSetAttrTab.begin();
    
    the HTMLAttrs::const_iterator CXXConstructExpr happens to have a second,
    defaulted argument.
    
    Change-Id: I882a6dfb5cab1b147f790072f2545b13172c0f9a
    Reviewed-on: https://gerrit.libreoffice.org/61530
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index c416d4be9ad1..869e368cc318 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -497,8 +497,11 @@ void UseUniquePtr::CheckLoopDelete(const FunctionDecl* 
functionDecl, const CXXDe
                     {
                         init = init->IgnoreImplicit();
                         if (auto x = dyn_cast<CXXConstructExpr>(init))
-                            if (x->getNumArgs() == 1)
+                            if (x->getNumArgs() == 1
+                                || (x->getNumArgs() >= 2 && 
isa<CXXDefaultArgExpr>(x->getArg(1))))
+                            {
                                 init = x->getArg(0)->IgnoreImplicit();
+                            }
                         if (auto x = dyn_cast<CXXMemberCallExpr>(init))
                             init = x->getImplicitObjectArgument();
                         if ((memberExpr = dyn_cast<MemberExpr>(init)))
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to