[Libreoffice-commits] core.git: compilerplugins/clang
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Aug 16 18:22:42 UTC 2018
compilerplugins/clang/ptrvector.cxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit f260284c3915fbd84430833f19ad8c053205ebce
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Aug 16 15:46:21 2018 +0200
Commit: Stephan Bergmann <sbergman at 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 <sbergman at 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
More information about the Libreoffice-commits
mailing list