May 2015
Intermediate to advanced
296 pages
5h 10m
English
In this recipe, you will learn about the static analysis of code, which is carried out by the Clang Static Analyzer. It is built on top of Clang and LLVM. The static analysis engine used by the Clang Static Analyzer is a Clang library, and it has the capability to be reused in different contexts by different clients.
We will take the example of the divide-by-zero defect and show you how the Clang Static Analyzer handles this defect.
You need to build and install LLVM along with Clang.
Perform the following steps:
$ cat sa.c int func() { int a = 0; int b = 1/a; return b; }
Read now
Unlock full access