How can I add default header search paths to a RefactoringTool?


I try to make a little tool for LibTooling based on clang-tools-extra/tool-template. My problem is that it does not initialize default C++ header search paths. So when I invoke my tool I got the following:
clang version 3.4 ( 65da8e952da32730202356290bb889c8839bbef5) ( 189c6235e7d783928c94cbfe4bccb39e4bd0b84f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
error: invalid argument ‘-std=c++11’ not allowed with 'C/ObjC’
clang Invocation:

clang -cc1 version 3.4 based upon LLVM 3.4svn default target x86_64-unknown-linux-gnu

#include “…” search starts here:
#include <…> search starts here:

End of search list.
In file included from UserData.h:3:
In file included from /usr/include/boost/date_time/posix_time/posix_time.hpp:14:
/usr/include/boost/date_time/compiler_config.hpp:11:10: fatal error: ‘cstdlib’ file not found

But when I use the clang++ I got no error, but the following output
#include <…> search starts here:
End of search list.

So the search path list is not initialized correctly in the tool. I have no idea how to fix that.

In compile_commands.json I have this:

“command”: “g++ -v -std=c++11 -Wall UserData.h -c”

I init RefactoringTool in this way:

cl::optstd::string build_path(cl::Positional, cl::desc(""));
cl::liststd::string source_paths(cl::Positional, cl::desc(" [… ]"), cl::OneOrMore);

static void
InitCompilationDatabase(std::shared_ptr& compilations)
if (!compilations)
std::string error_message;
compilations.reset(CompilationDatabase::loadFromDirectory(build_path, error_message));
if (!compilations)

int main(int argc, const char **argv)

std::shared_ptr compilations(FixedCompilationDatabase::loadFromCommandLine(argc, argv));
cl::ParseCommandLineOptions(argc, argv);


tooling::RefactoringTool tool(*compilations, source_paths);
ast_matchers::MatchFinder finder;

std::unique_ptrclang::tooling::FrontendActionFactory frontendAction(newFrontendActionFactory(&finder));