[cfe-dev] Generating index file for CTU analysis
Gábor Márton via cfe-dev
cfe-dev at lists.llvm.org
Tue Apr 2 02:01:38 PDT 2019
To generate a compile_commands.json file and this is independent from
cross translation unit analysis. You would need this file even if you
were not doing CTU but a single TU based analysis. If you have a CMAKE
project, then you can set -DCMAKE_EXPORT_COMPILE_COMMANDS=1.
Otherwise, intercept-build has issues on MacOS, so you may try to use
alternatives like bear (https://github.com/rizsotto/Bear). AFAIK, Bear
should work on Linux too, but on Linux the best approach is to use the
"CodeChecker log" command to get the compile commands
We actively develop CTU with CodeChecker as a "runner" script,
scan-build on the other hand is not actively developed (it has
different errors and issues, expect it to work with the very basic
Hope this helps,
On Mon, Apr 1, 2019 at 6:12 PM Kristóf Umann <dkszelethus at gmail.com> wrote:
> Adding some folks more knowledgeable on this topic :) Gábor, Endre, do you know what's the issue here? Do we have this documented somewhere?
> On Sat, 30 Mar 2019 at 01:16, Gavin Cui via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>> Hi, I was trying to play with the cross translation unit analysis by passing the argument '-analyzer-config experimental-enable-naive-ctu-analysis=true'. However, it seems I need to generate an 'externalDefMap.txt' file at first. Then I found that I may be able to use 'intercept-build <build-command>' and 'analyze-build --ctu-collect-only' script for generating this file.
>> I currently stack at the intercept build step,
>> But after running 'intercept-build gcc -o test test.c foo.c', I got an empty 'compile_commands.json' file.
>> How could I address this problem or is there any other way to generate the CTU index file?
>> Thank you!
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
More information about the cfe-dev