Using libtooling to parse C++ code

How did you do that? Did you change the language option somewhere?

This is what I included in the main function:

CommonOptionsParser op(argc, argv);
// create a new Clang Tool instance (a LibTooling environment)
ClangTool Tool(op.getCompilations(), op.getSourcePathList());
// run the Clang Tool, creating a new FrontendAction (explained below)
int result =<myFrontendAction>());

It seems that C is the default language in CompilerInstance and CompilerInvocation. Should I do something to change that? Or I should pass some argument when I run the tool I write?


Yes, I have the same initialization code. When I feed it a C++ file,
it just compiles it.


Clang by default uses the file extension to determine the language. If you pass it a .h file you can say -x c++ or -x c+┬▒header