= Using clang for static analysis = LLVM/Clang comes with a static analyzer that can be used to generate web-based analysis reports for many bug categories. == Prerequistities == Make sure the analyzer is installed on your system. On Fedora 24 the package is called clang-analyzer. Also make sure you have web browser installed. == Running the analysis == Configure HelenOS for e.g. amd64 and in the HelenOS source root directory run the following command: {{{ $ scan-build make PROFILE=amd64 }}} This should kick off the static analysis process and result in a message like the following: {{{ scan-build: 121 bugs found. scan-build: Run 'scan-view /tmp/scan-build-2016-07-18-210821-13060-1' to examine bug reports. }}} == Inspecting the results == When the analysis run is finished, one can inspect the result by running the following command (assuming the output above) and pointing her web browser at the provided URL (the command attempts to do that automatically): {{{ $ scan-view /tmp/scan-build-2016-07-18-210821-13060-1 Starting scan-view at: http://127.0.0.1:8181 Use Ctrl-C to exit. Created new window in existing browser session. }}} Now you should be able to inspect the results in your web browser: [[Image(clang-analyzer-report.png)]]