LibTooling and Header files confirmation

Good day,
I have some aspects I would like confirm about reading header files in the context of LibTooling.
My initial idea is that clang, as a compiler framework, mainly ‘works with source files’.
Header files will come in during pre-processing via the #include directive.
But I wanted to see for myself how libtooling works with header files explicitly passed as argument. For this experiment, I used clang-check.
Eventually, I came across this question:
http://stackoverflow.com/questions/19413156/clang-cant-parse-my-h-file-standalone
Confirmation #1: Is there an official documentation/url/FAQ where it is written that clang treats *.h files as C header files?
Or rather, perhaps there is a documentation as to the list of file extensions with the description as to what actions clang will take?
Confirmation #2: I tried checking the help for clang-check and I am not sure how to pass an argument similar to “-x c++” to it. Is it possible?
Confirmation #3: Is there a ‘correct’ approach with regards to libtooling and handling header files? I am planning on ignoring header files passed to my libtool.
Hoping for your insights.
Thank you,
David

Hi David,

Hi David,

Good day,
I have some aspects I would like confirm about reading header files in
the context of LibTooling.
My initial idea is that clang, as a compiler framework, mainly 'works
with source files'.
Header files will come in during pre-processing via the #include
directive.
But I wanted to see for myself how libtooling works with header files
explicitly passed as argument. For this experiment, I used clang-check.
Eventually, I came across this question:

http://stackoverflow.com/questions/19413156/clang-cant-parse-my-h-file-standalone
Confirmation #1: Is there an official documentation/url/FAQ where it is
written that clang treats *.h files as C header files?
Or rather, perhaps there is a documentation as to the list of file
extensions with the description as to what actions clang will take?

I do not think there is anything specific to clang there.

What is in the header in treated dependingly on the source it was included
from : you can include a C header from a C++ file. So with a '.h'
extension, the compiler has to assume it is C. If you use other usual
extensions (.hpp, ...) then C++ will be assumed. I do not have any pointer
to some doc/url/faq on top of my head.

Confirmation #2: I tried checking the help for clang-check and I am not
sure how to pass an argument similar to "-x c++" to it. Is it possible?

Yes it is possible:
clang-check yout_header.h -- -x c++

Keep in mind that clang-check makes use of the compilation database, and
it only contains info for source files, not headers. The syntax above
allows you to add some options to what was found in the database, or get
some options eventhough the file was not in the database.

Slight mistake there. clang-check uses optionally the compilation database
(when the -p build_path is provided). Using "clang-check your_file --
your_options" will set the flags to use, irrespective of the use of
compilation database or not.