libclang - forcing of the ClangTool using the C++ mode

Hi all,

I'm not sure whether this is the right mail list for my question but I'll try.

I work on a simple framework for automated testing (can be seen at The framework describes tests as
a valid C++ files but there is a need for some preprocessing. And this
is the job for the libclang. Everything worked fine until I decided
to change suffix of the test files (different suffix is more easy
for build tools like (auto)make). Since, the ClangTool supposes
the input file as a linker input. I have tried the '-xc++' switch,
but with no success. How can I force the tool to handle my sources as C++?

I use the libLLVM and libclang 5.0

There is a simplified code here:

/* -- prepare compiler options */
std::vector<std::string> opts_;

/* -- parse the file */
std::vector<const char*> argv_;
for(const auto& arg_ : opts_)
int argc_(argv_.size());
clang::tooling::CommonOptionsParser parseropts_(
    argc_,, ParserOptCategory);
clang::tooling::ClangTool tool_(
int retval_( FrontendFactory));

Thank you for your help.