[cfe-dev] accessing command line options

Kristóf Umann via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 11 06:27:21 PDT 2019

Hmm. Yea, I don't think you can do that now. It might be possible somehow,
I just don't  know how, and I doubt that there is a way. The best course of
action would be to add a checker option.

1. Add a brief documentation about that flag in the file's headings (below
the licence thingie)
2. Add a new string field to your checker class. Initialize it in the
checker registry function (registerYourChecker) by calling
3. You may configure your checker on the command line by appending this to
the analyzer invocation: -analyzer-config

Mind you, there are around 10 patches on review that will overhaul the
checker option interface, so you might need to rebase sometime soon on top
of it :)

Thanks for reaching out, I might take a look at this later! There are some
legitimate cases where accessing the output dir would be neat, for example,
we could get rid of the "ctu-dir" option entirely.


On Thu, 11 Apr 2019 at 15:04, Kihong Heo <kihong.heo at gmail.com> wrote:

> Thanks a lot.
> I want to keep some additional information and intermediate results during
> analysis and dump it in the given output directory. What would be the
> simplest way?
> -Kihong
> 2019. 4. 11. 오전 8:59, Kristóf Umann <dkszelethus at gmail.com> 작성:
> Hi!
> You may use the AnalyzerOptions class to retrieve analyzer specific
> command line options, and you can get one easily from CheckerContext. For
> the output directory, FrontendOptions should be used, but I don't think you
> can get your hands on it from a checker callback. What would you like to
> achieve?
> Cheers,
> Kristóf
> On Thu, 11 Apr 2019 at 07:16, Kihong Heo via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>> Hi list,
>> How can I get command line options, especially “-o” of scan-build (output
>> directory), in a checker function such as “checkEndAnalysis”?
>> Thanks,
>> Kihong
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190411/d587a221/attachment.html>

More information about the cfe-dev mailing list