Passing Arguments to Checker

Hello,

I have written a checker and I am wondering if there is anyway to pass an argument to the checker (constructor of my checker class), the scan-build command line being the source of the argument ?

Thanks in advance,

Tarun

As of yet, no. We've talked about it some (most recently off-list) and agreed that it's probably useful, but there's no facility for it yet. Of course, suggestions on how this should work are always welcome; patches are even better.

Meanwhile, if you're looking for a boolean toggle or a choice between a small set of values, you can fake it by having several registration functions that actually register the same checker. See NSErrorChecker for an example of this.

There should probably be a report about this on Bugzilla...

Jordy

Thanks Jordy for the prompt response.

I am facing another problem. My checker makes function calls into some utility C++ code (which is independent of clang). I want the utility code to be compiled as a separate library (say abc.a) and abc.a could be linked to the clangStaticAnalyzerCheckers.a (the checkers library).

I have been able to build the utility C++ code into a library (abc.a) through the clang Make system by following the structure of clang Makefiles. I placed the utility code at the clang/lib/StaticAnalyzer directory (along with Checkers dir) for that.

I used the USEDLIBS option in the StaticAnalyzer/Checkers/Makefile i.e. USELIBS:=abc.a

But, I get linker error when I refer something in the utility code from the checker, because clangStaticAnalyzerCheckers.a is not linked to my abc.a

Thanks again!

Tarun