[cfe-users] Fwd: [cfe-dev] matcher for obj-c variable declarations.

2016-09-16 Thread Alfred Zien via cfe-users
cfe-dev was wrong list may be?

> 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 =
>   declStmt(hasSingleDecl(varDecl(hasType(objcObjectPointerType()
> 
> 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!
> ___
> cfe-dev mailing list
> cfe-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

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


[cfe-users] objc. __auto_type and nullablility inheritance.

2016-12-12 Thread Alfred Zien via cfe-users
Hi to everyone! I'm integrating __auto_type to project, and I faced with some 
weird issue. 

__auto_type doesn't inherit nullability nor ownership qualifiers, so if I write

__weak Type* _Nonnull a = f();
__auto_type b = a;

b will be just Type*, with strong ownership and __nullability_unspecified 
specifier.

Although, if I'm writing

__weak Type* _Nonnull a = f();
__typeof(a) b = a;

Everything inherits as expected. So type of b is __weak Type* _Nonnull.
I know, __weak and _Nullable doesn't make any sense for one variable 
declaration, but I think you get the point.

Is it ok? Why such decision has been made?
Thanks for any clarification.___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


[cfe-users] How to use clang-tidy plugin.

2017-01-17 Thread Alfred Zien via cfe-users
Hi! I need to use clang-tidy as a clang plugin, but can't figure out how to do 
it. 

I see ClangTidyPlugin.cpp file, and there is ClangTidyPlugin target, but when I 
run `make clangTidyPlugin` it produces only libclangTidyPlugin.a, no any 
dynamic library. Am I doing something wrong? Is it even possible?

Thanks for any help.
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] How to use clang-tidy plugin.

2017-01-17 Thread Alfred Zien via cfe-users
Hmm, I discovered that it is actually part of libclang. But still, I run
   $ clang main.c -fsyntax-only -Xclang -load -Xclang 
/Users/zienag/dev/llvm_trunk/build/lib/libclang.dylib -Xclang -plugin -Xclang 
clang-tidy
And it produces error:
   error: unable to find plugin 'clang-tidy'
:(

> On 17 Jan 2017, at 18:12, Alfred Zien via cfe-users 
>  wrote:
> 
> Hi! I need to use clang-tidy as a clang plugin, but can't figure out how to 
> do it. 
> 
> I see ClangTidyPlugin.cpp file, and there is ClangTidyPlugin target, but when 
> I run `make clangTidyPlugin` it produces only libclangTidyPlugin.a, no any 
> dynamic library. Am I doing something wrong? Is it even possible?
> 
> Thanks for any help.
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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


Re: [cfe-users] How to use clang-tidy plugin.

2017-01-20 Thread Alfred Zien via cfe-users
Thanks for clarifying! Based on this, as I understand, we can't use any other 
library (for example ASTMatchers) in plugin that clang doesn't use?

> On 19 Jan 2017, at 19:44, Benjamin Kramer  wrote:
> 
> I don't think I ever added the build rules to build clang-tidy as a
> plugin for use outside of libclang. You can use it via libclang and
> the python bindings currently. Adding the necessary build rules isn't
> easy because you'd have to avoid linking clang symbols into both the
> plugin and the actual clang binary, the current cmake layout doesn't
> really support that :(
> 
> On Tue, Jan 17, 2017 at 4:12 PM, Alfred Zien via cfe-users
>  wrote:
>> Hi! I need to use clang-tidy as a clang plugin, but can't figure out how to 
>> do it.
>> 
>> I see ClangTidyPlugin.cpp file, and there is ClangTidyPlugin target, but 
>> when I run `make clangTidyPlugin` it produces only libclangTidyPlugin.a, no 
>> any dynamic library. Am I doing something wrong? Is it even possible?
>> 
>> Thanks for any help.
>> ___
>> cfe-users mailing list
>> cfe-users@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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