summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-31 21:01:18 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-10-31 21:01:18 +0100
commitf25a15dc99b00dfd2def8bc4d6772b14a78a8a6c (patch)
tree8244a3d3c88f98c476a42e6f1a771cdee99ca5a2 /compilerplugins
parent04055cd8d9fcff67513cfd7de0872cb48bc82967 (diff)
loplugin:vclwidgets: Adapt iterator hack to libc++
Change-Id: I1e4fbb06578b2b1d6de4b57507693b014d36cd3a
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 559b70c58538..2b1da0280ca5 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -273,8 +273,11 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
}
// Apparently I should be doing some kind of lookup for a partial specialisations of std::iterator_traits<T> to see if an
// object is an iterator, but that sounds like too much work
- std::string s = pVarDecl->getType().getDesugaredType(compiler.getASTContext()).getAsString();
- if (s.find("iterator") != std::string::npos) {
+ auto t = pVarDecl->getType().getDesugaredType(compiler.getASTContext());
+ std::string s = t.getAsString();
+ if (s.find("iterator") != std::string::npos
+ || loplugin::TypeCheck(t).Class("__wrap_iter").StdNamespace())
+ {
return true;
}
// std::pair seems to show up in whacky ways in clang's AST. Sometimes it's a class, sometimes it's a typedef, and sometimes