Chapter 5. Development Tools

Table of Contents

Clang Static Analyzer

Clang Static Analyzer

The clang static analyzer is a tool that helps find bugs. To run it on the MPD code base, install LLVM and clang. Configure MPD to use clang:

./configure --enable-debug CXX=clang++ CC=clang ...

It is recommended to use --enable-debug, because the analyzer takes advantage of assert() calls, which are only enabled in the debug build.

Now run the analyzer:

scan-build --use-c++=clang++ --use-cc=clang make

The options --use-c++ and --use-cc are necessary because it invokes cc for actually compiling the sources by default. That breaks, because MPD requires a C99 compiler.