loplugin:vclwidgets: Adapt iterator hack to libc++

Change-Id: I1e4fbb06578b2b1d6de4b57507693b014d36cd3a
This commit is contained in:
Stephan Bergmann 2016-10-31 21:01:18 +01:00
parent 04055cd8d9
commit f25a15dc99

View File

@ -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 // 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 // object is an iterator, but that sounds like too much work
std::string s = pVarDecl->getType().getDesugaredType(compiler.getASTContext()).getAsString(); auto t = pVarDecl->getType().getDesugaredType(compiler.getASTContext());
if (s.find("iterator") != std::string::npos) { std::string s = t.getAsString();
if (s.find("iterator") != std::string::npos
|| loplugin::TypeCheck(t).Class("__wrap_iter").StdNamespace())
{
return true; 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 // 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