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

Writing your own tool


The Clang project provides three interfaces that a user can rely on to utilize Clang features and its parsing capabilities, including syntactic and semantic analyses. First, there is libclang, the primary way of interfacing with Clang, which provides a stable C API and allows an external project to plug it in and have a high-level access to the entire framework. This stable interface seeks to preserve backwards compatibility with older versions, avoiding breaking your software when a newer libclang is released. It is also possible to use libclang from other languages, for example, using the Clang Python Bindings. Apple Xcode, for instance, interacts with Clang via libclang.

Secondly, there are Clang Plugins that allow you to add your own passes during compilation, as opposed to the offline analyses performed by tools such as Clang Static Analyzer. It is useful when you need to perform it every time you compile a translation unit. Therefore, you need to be concerned with...