[PATCH] D50488: [Analyzer] Checker for non-determinism caused by sorting of pointer-like keys
Umann Kristóf via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 21 05:00:23 PDT 2018
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
More information about the cfe-commits
mailing list