summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-08-16 15:46:21 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-08-16 20:22:17 +0200
commitf260284c3915fbd84430833f19ad8c053205ebce (patch)
tree5b34cb61dff8c32358ffd9afac9da65011901994
parentd43e61962c5abdb435eff08c64a5476dfb99028a (diff)
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 <sbergman@redhat.com>
-rw-r--r--compilerplugins/clang/ptrvector.cxx7
1 files changed, 6 insertions, 1 deletions
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