O'Reilly logo

Getting Started with LLVM Core Libraries by Rafael Auler, Bruno Cardoso Lopes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Putting it together

In this example, we will take the opportunity to introduce you to the Clang C++ interface and will not rely on the libclang C interface anymore. We will create a program that will apply the lexer, the parser, and the semantic analysis to input files by using the internal Clang C++ classes; thus, we will have the opportunity to do the work of a simple FrontendAction object. You can continue using the Makefile that we presented at the beginning of this chapter. However, you may be interested in turning off the -Wall -Wextra compiler flags because it will generate a large volume of warnings for Clang headers regarding unused parameters.

The source code for this example is reproduced as follows:

#include "llvm/ADT/IntrusiveRefCntPtr.h" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required