compilerplugins/clang/ptrvector.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit f260284c3915fbd84430833f19ad8c053205ebce
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Aug 16 15:46:21 2018 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Aug 16 20:22:17 2018 +0200

    Adapt loplugin:ptrvector to libc++ (on macOS)
    
    ...where it produced false positive
    
    > 
/Users/stephan/Software/lo2/core/UnoControls/source/controls/progressmonitor.cxx:245:21:
 error: do not call operator== on a std container containing a unique_ptr const 
class std::__1::__wrap_iter<class std::__1::unique_ptr<struct 
unocontrols::IMPL_TextlistItem, struct std::__1::default_delete<struct 
unocontrols::IMPL_TextlistItem> > *> [loplugin:ptrvector]
    >             if (itr != maTextlist_Top.end())
    >                     ^
    
    Change-Id: I8a8b6f30145e6aff2caa03c03f0fd20af0ba42b5
    Reviewed-on: https://gerrit.libreoffice.org/59181
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/ptrvector.cxx 
b/compilerplugins/clang/ptrvector.cxx
index 40e37e5937c9..ed0893e3558f 100644
--- a/compilerplugins/clang/ptrvector.cxx
+++ b/compilerplugins/clang/ptrvector.cxx
@@ -13,6 +13,8 @@
 #include <iostream>
 #include <fstream>
 #include <set>
+
+#include "check.hxx"
 #include "plugin.hxx"
 
 /**
@@ -54,7 +56,10 @@ bool PtrVector::VisitCXXOperatorCallExpr(const 
CXXOperatorCallExpr* expr)
     }
     const Expr* argExpr = expr->getArg(0);
     std::string s = 
argExpr->getType().getDesugaredType(compiler.getASTContext()).getAsString();
-    if (s.find("iterator") != std::string::npos) {
+    if (s.find("iterator") != std::string::npos
+        || 
(loplugin::TypeCheck(argExpr->getType()).Class("__wrap_iter").Namespace("__1")
+            .StdNamespace()))
+    {
         return true;
     }
     if (s.find("array") == std::string::npos && s.find("deque") == 
std::string::npos
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to