Running Clang Static Analyzer Checker on ISL Codebase

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.

Malhar Thakkar

Thank you Jonathan.

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


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))"'


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


Thank you so much, Dr. Sven.
Your answer is exactly what I was looking for.