Quantcast

Running Clang Static Analyzer Checker on ISL Codebase

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Running Clang Static Analyzer Checker on ISL Codebase

Martin J. O'Riordan via cfe-dev
Hello all,

I wish to run Clang Static Analyzer's RetainCountChecker.cpp on the ISL codebase. While trying to test it on a single ISL file (isl_band.c), it asks me to use quotes instead of angular brackets for various header files which are in the ISL source directory.

In the $LLVM_BUILD/bin directory, I am running the following command
./clang -cc1 -analyze -analyzer-checker=osx.cocoa.RetainCount ../../../isl-0.18/isl_band.c

Also, to run this checker, I have added the following macros to isl_band.c
#define __isl_take __attribute__((cf_consumed))
#define __isl_give __attribute__((cf_returns_retained))
#define __isl_keep

Replacing angular brackets with quotes on the entire codebase will be a tedious task.

Could anyone please suggest me an easier way to run RetainCountChecker.cpp on the entire ISL codebase?

Thank you.



Regards,
Malhar Thakkar

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running Clang Static Analyzer Checker on ISL Codebase

Martin J. O'Riordan via cfe-dev
Thank you Jonathan.

I added -I/usr/local/isl/ -I/Users/malharthakkar/isl-0.18/ to the aforementioned and it's working now.


Regards,
Malhar

On Fri, May 19, 2017 at 12:33 PM, Jonathan Coe <[hidden email]> wrote:


On 19 May 2017, at 07:07, Malhar Thakkar via cfe-dev <[hidden email]> wrote:

Hello all,

I wish to run Clang Static Analyzer's RetainCountChecker.cpp on the ISL codebase. While trying to test it on a single ISL file (isl_band.c), it asks me to use quotes instead of angular brackets for various header files which are in the ISL source directory.


I've found that adding include paths as system include paths solves this issue. 
For CMake, one uses include_directories (SYSTEM my include paths).
I'm not sure what build system you are using but I'm sure a similar solution exists.

In the $LLVM_BUILD/bin directory, I am running the following command
./clang -cc1 -analyze -analyzer-checker=osx.cocoa.RetainCount ../../../isl-0.18/isl_band.c

Also, to run this checker, I have added the following macros to isl_band.c
#define __isl_take __attribute__((cf_consumed))
#define __isl_give __attribute__((cf_returns_retained))
#define __isl_keep

Replacing angular brackets with quotes on the entire codebase will be a tedious task.

Could anyone please suggest me an easier way to run RetainCountChecker.cpp on the entire ISL codebase?

Thank you.



Regards,
Malhar Thakkar
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [isl-dev] Running Clang Static Analyzer Checker on ISL Codebase

Martin J. O'Riordan via cfe-dev
In reply to this post by Martin J. O'Riordan via cfe-dev
On Fri, May 19, 2017 at 11:37:57AM +0530, 'Malhar Thakkar' via isl Development wrote:

> Hello all,
>
> I wish to run Clang Static Analyzer's RetainCountChecker.cpp on the ISL
> codebase. While trying to test it on a single ISL file (isl_band.c), it
> asks me to use quotes instead of angular brackets for various header files
> which are in the ISL source directory.
>
> In the $LLVM_BUILD/bin directory, I am running the following command
> *./clang -cc1 -analyze -analyzer-checker=osx.cocoa.RetainCount
> ../../../isl-0.18/isl_band.c*
>
> Also, to run this checker, I have added the following macros to *isl_band.c*
> *#define __isl_take __attribute__((cf_consumed))*
> *#define __isl_give __attribute__((cf_returns_retained))*
> *#define __isl_keep*
>
> Replacing angular brackets with quotes on the entire codebase will be a
> tedious task.
>
> Could anyone please suggest me an easier way to run RetainCountChecker.cpp
> on the entire ISL codebase?

You are not going to find many experts on the Clang Static Analyzer here.
AFAIU, you are not supposed to run the analyzer directly
(unless you know how to set up the right compiler flags).
According to a message of mine on 6 Jan 2017, this might work:

scan-build -enable-checker osx.cocoa.RetainCount make CC="gcc" CFLAGS='-D__isl_give="__attribute__((cf_returns_retained))" -D__isl_take="__attribute__((cf_consumed))"'

skimo
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [isl-dev] Running Clang Static Analyzer Checker on ISL Codebase

Martin J. O'Riordan via cfe-dev
On Fri, May 19, 2017 at 12:25:34PM +0200, Sven Verdoolaege via cfe-dev wrote:
> You are not going to find many experts on the Clang Static Analyzer here.

I meant on the isl mailing list.
I didn't notice the message was cross-posted.

skimo
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [isl-dev] Running Clang Static Analyzer Checker on ISL Codebase

Martin J. O'Riordan via cfe-dev
In reply to this post by Martin J. O'Riordan via cfe-dev
Thank you so much, Dr. Sven. 
Your answer is exactly what I was looking for.

Regards,
Malhar

On May 19, 2017 15:55, "Sven Verdoolaege" <[hidden email]> wrote:
On Fri, May 19, 2017 at 11:37:57AM +0530, 'Malhar Thakkar' via isl Development wrote:
> Hello all,
>
> I wish to run Clang Static Analyzer's RetainCountChecker.cpp on the ISL
> codebase. While trying to test it on a single ISL file (isl_band.c), it
> asks me to use quotes instead of angular brackets for various header files
> which are in the ISL source directory.
>
> In the $LLVM_BUILD/bin directory, I am running the following command
> *./clang -cc1 -analyze -analyzer-checker=osx.cocoa.RetainCount
> ../../../isl-0.18/isl_band.c*
>
> Also, to run this checker, I have added the following macros to *isl_band.c*
> *#define __isl_take __attribute__((cf_consumed))*
> *#define __isl_give __attribute__((cf_returns_retained))*
> *#define __isl_keep*
>
> Replacing angular brackets with quotes on the entire codebase will be a
> tedious task.
>
> Could anyone please suggest me an easier way to run RetainCountChecker.cpp
> on the entire ISL codebase?

You are not going to find many experts on the Clang Static Analyzer here.
AFAIU, you are not supposed to run the analyzer directly
(unless you know how to set up the right compiler flags).
According to a message of mine on 6 Jan 2017, this might work:

scan-build -enable-checker osx.cocoa.RetainCount make CC="gcc" CFLAGS='-D__isl_give="__attribute__((cf_returns_retained))" -D__isl_take="__attribute__((cf_consumed))"'

skimo

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...