By default, LLVM and clang are compiled with the -fno-rtti flag. This means that RTTI support is disabled. However, when using libraries such as Boost, it is necessary to recompile LLVM and clang with RTTI enabled. While there is documentation on how to do it here, it happened to be more involved than just that.

We need to set the LLVM_REQUIRES_RTTI variable in order to get LLVM to compile with RTTI. Assuming $LLVM_ROOT is the directory location for the LLVM source, and $CLANG_ROOT points to the directory where clang is installed.

Go to the $LLVM_ROOT directory.

1
cd $LLVM_ROOT
Edit the CMakeLists.txt, and add the following:
1
set(LLVM_REQUIRES_RTTI 1)

Now suppose that you are compiling a plugin for clang that needs the boost libraries. For example, let us assume that we want to add boost libraries to one of the clang example plugins PrintFunctionNames.

Go to the directory where that example resides:
1
cd $LLVM_ROOT/tools/clang/examples/PrintFunctionNames

The next step is to let cmake find boost libraries. The best way to do this is to allow find_package to find boost. To do this, make sure that environment variable BOOST_ROOT is set to the path where boost is installed.

1
export BOOST_ROOT=/usr/local/boost_1_50_0

Then edit CMakeLists.txt and add the following lines. The additional versions line should have the version numbers of the boost library that is available in the system.

1
2
3
4
5
6
7
set(Boost_ADDITIONAL_VERSIONS "1.49" "1.49.0" "1.50" "1.50.0")

find_package( Boost  REQUIRED)
if(Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIR})
endif()
message("boost: ${Boost_INCLUDE_DIRS}")

That's all. Using the typical cmake compile procedure, RTTI should be enabled.

Thanks to Naman Kumar for his help in figuring this out.