[cfe-dev] matcher for obj-c variable declarations.
Alfred Zien via cfe-dev
cfe-dev at lists.llvm.org
Thu Sep 15 01:49:34 PDT 2016
Hi to everyone!
I'm new to clang and libtooling, and I'm making some cheker tool that emits a error if any obj-c variable declaration doesn't have nullability specifier.
I have code like this
A* a = [[A alloc] init];
B* _Null_unspecified b = [[B alloc] init];
C* _Nullable c = [[C alloc] init];
D* _Nonnull d = [[D alloc] init];
Now, I want to create a matcher to match variables declaration.
Currently I have something like this:
StatementMatcher NullUnspecifiedMatcher =
There is objcObjectPointerType() but it matches only a (is it a bug?). There are some pointers/references matchers, but they don't work on those variable declarations at all. Also, I tried isAnyPointer() but it works on any pointer, obj-c or not.
I tried type() to ensure, that I'm doing everything correctly, and it works.
So, how can I match only obj-c variable declarations, with or without nullability specifier?
Thanks for any help!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev