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

Generating a compile command database


In general, a compiler is called from a build script, for example, Makefiles, with a series of parameters that configure it to adequately use project headers and definitions. These parameters allow the frontend to correctly lex and parse the input source code file. However, in this chapter, we will study standalone tools that will run on their own, and not as part of the Clang compilation pipeline. Thus, in theory, we would need a specific script to run our tool with the correct parameters for each source file.

For example, the following command shows the full command line used by Make to invoke a compiler to build a typical file from the LLVM library:

$ /usr/bin/c++   -DNDEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -fno-rtti -I/Users/user/p/llvm...