[cfe-dev] Static Analyzer Question

Anna Zaks ganna at apple.com
Wed Apr 1 11:07:08 PDT 2015


> On Mar 31, 2015, at 9:09 AM, Brugnoni Silvano <sbrugnon at hsr.ch> wrote:
> 
> Hi all,
> 
> I’m working on a static analysis tool to detect low-level data races in C++ code. The analysis I’m trying to implement requires a control flow graph (CFG) of the entire program.
> 
> I’m currently working the construction of this whole-program CFG using the Clang Static Analyzer. I’m aware that cross-translation unit IPA is not supported by the static analyzer by default. But I think it should be possible to extract the CFG of each translation unit independently using a custom checker, and then merge them together into a whole-program CFG afterwards. I plan to perform the merging and the subsequent analysis from a standalone tool based on LibTooling. This brings me to my question:
> 
> Is it possible to run a checker from a clang standalone tool without having to compile it into clang? From what I can tell, the AnalysisConsumer, which  is in charge of running the path-sensitive analyses, is located in an anonymous namespace and there is no way of passing it an additional checker to execute. I would appreciate it if you could clarify this.
> 

We have unsupported plugins feature. You can find a very useful manual by searching cfe-dev for "Tutorial for Clang Analyzer Plugins".

> Since I have not been able to run a checker from a clang standalone tool myself, I explored a different route: I tried to instantiate the clang::into::ExprEngine and its dependencies from within a custom FrontendAction in order to obtain the translation-unit CFG this way. However, I keep getting Segmentation Faults, and sometimes even Bus Errors when I run this program, depending on the exact code and compiler optimization settings. These Errors are probably caused by my lack of understanding of the clang code base, and I’m still investigating what is missing/wrong with my code. Still, I attached a simplified version of the program. Any advice is appreciated as well.
> 
> Regards,
> Silvano
> 
> <main.cpp>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150401/61bc8542/attachment.html>


More information about the cfe-dev mailing list