Szelethus added a comment.

In https://reviews.llvm.org/D50488#1204655, @mgrang wrote:

> In https://reviews.llvm.org/D50488#1203876, @Szelethus wrote:
>
> >
>
>
> This is my first time with ASTMatchers and I am not sure how to get the 
> value_type from hasType (I don't see a matcher for value_types in 
> ASTMatchers.h). Would I end up using a visitor for that? If yes, then maybe 
> the entire check for pointer types needs to be done via visitors? Sorry for 
> the newbie questions :)


I played around for a bit, my `clang-query` is a little out of date, but here's 
what I found: You can match `typedef`s with `typedefDecl()`, and `using` by 
`typeAliasDecl()`, and then add `hasName("value_type")` as a parameter. As to 
how to check whether a type has any of these, I'm a little unsure myself, but 
you could use `hasDescendant`, and narrow down the matches.

I'm not sure whether this checks inherited type declarations, and it sure 
doesn't check template specializations of `std::iterator_traits`, but it is a 
good start :) I'll revisit this when I have a little more time on my hand.


https://reviews.llvm.org/D50488



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to