[cfe-dev] [Proposal] New tool contributions to clang repository (gcc/g++ compilation database converter, plist to HTML converter)

György Orbán via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 25 11:41:44 PDT 2018

Hi All,

There are multiple features in CodeChecker which could be split into smaller tools so the community could benefit from them.

1. gcc/g++ compilation database to Clang compilation database conversion tool
2. Plist to HTML report conversion tool

1. gcc/g++ compilation database to Clang compilation database conversion tool

One problem is what we want to address is that gcc/g++ compilation commands cannot be forwarded without modification
to the Clang based tools as they were logged or exported by the build system.

Post-processing of the compilation command is required:
- might contain compilation flags and build targets which are not compatible with Clang (needs to be filtered out)
- the compilation argument filtering needs to be done in every tool which uses the compilation database json (scan-build, scan-build-py, CodeChecker)
- when gcc is used as a cross compiler, hard-coded include paths, flags and compilation target of gcc/g++ are missing from the command line argument list. These needs to be auto-detected and passed to Clang before analysis.
- C/C++ standard versions might be missing from the compilation commands which could change the analysis results (c++11 checker triggers for c++98 code)

Our idea is to create a separate tool which could transform a gcc/g++ compilation database file into a compile command json file which can be used by Clang based tools without further modification.
The non-compatible flags are filtered out and the necessary cross compilation include paths and compilation flags are added.
Other Clang based tools could also benefit from the converted compilation database json, like clangd.

2. Plist to HTML report conversion tool (see the source code at https://github.com/Ericsson/codechecker/tree/master/vendor/plist_to_html )

Currently Clang Static Analyzer can produce HTML output but this should not be done necessarily by the analyzer.
Plist reports can contain much more information and are easier to manage and parse by other tools compared to the html reports.
With our HTML generator tool we can generate static HTML reports which look similar to the report visualization in Xcode or
to the report viewer web UI of CodeChecker. You can move on each event through a bug path and arrows are shown for easier understanding.

Let us know what do you think about these tools, how well would they fit near the available tools.
Your feedback is appreciated.

Gyorgy Orban
CodeChecker Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180925/7a6235b7/attachment.html>

More information about the cfe-dev mailing list