Book Image

Getting Started with LLVM Core Libraries

Book Image

Getting Started with LLVM Core Libraries

Overview of this book

Table of Contents (17 chapters)
Getting Started with LLVM Core Libraries
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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

clang –cc1 –analyze –analyzer-checker =<package> &lt...