<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 2, 2014 at 12:00 PM, Arnaud Allard de Grandmaison <span dir="ltr"><<a href="mailto:arnaud.adegm@gmail.com" target="_blank">arnaud.adegm@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David,<div><br></div><div class="gmail_extra"><div class="gmail_quote"><div class="">On Fri, May 2, 2014 at 5:10 AM, DbdM Tbt <span dir="ltr"><<a href="mailto:spin.x2k@gmail.com" target="_blank">spin.x2k@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Good day,<br>I have some aspects I would like confirm about reading header files in the context of LibTooling.<br>

My initial idea is that clang, as a compiler framework, mainly 'works with source files'.<br>
Header files will come in during pre-processing via the #include directive.<br>But I wanted to see for myself how libtooling works with header files explicitly passed as argument. For this experiment, I used clang-check.<br>


Eventually, I came across this question:<br><a href="http://stackoverflow.com/questions/19413156/clang-cant-parse-my-h-file-standalone" target="_blank">http://stackoverflow.com/questions/19413156/clang-cant-parse-my-h-file-standalone</a><br>


Confirmation #1: Is there an official documentation/url/FAQ where it is written that clang treats *.h files as C header files?<br> Or rather, perhaps there is a documentation as to the list of file extensions with the description as to what actions clang will take?<br>

</div></blockquote><div><br></div></div><div>I do not think there is anything specific to clang there.</div><div><br></div><div>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.</div>
<div class="">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
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?<br></div></blockquote><div><br></div></div><div>Yes it is possible:</div>

<div>clang-check yout_header.h -- -x c++</div><div> </div><div>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.</div>
</div></div></div></blockquote><div><br></div><div>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<br>

</div></blockquote><div><br></div></div><div>It all depends on your application.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div dir="ltr">

Hoping for your insights.<br>Thank you,<br>David<br><br></div>
<br></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>