Testing the static analyzer
In this section, we will explore how to use the Clang Static Analyzer in practice.
Using the driver versus using the compiler
Before testing the static analyzer, you should always keep in mind that the command line clang -cc1
refers directly to the compiler, while using the command line clang
will trigger the compiler driver. The driver is responsible for orchestrating the execution of all other LLVM programs involved in a compilation, but it is also responsible for providing adequate parameters about your system.
While using the compiler directly is preferred among some developers, sometimes it may fail to locate system header files or other configuration parameters that only the Clang driver knows. On the other hand, the compiler may present exclusive developer options that allow us to debug it and see what is happening inside. Let's check how to use both to check a single source code file.
Compiler |
|