Peter, your remark regarding the HeaderSearchOptions::ResourceDir solved the problem.<br><br>My ResourceDir was an empty string, I didn't know it had to be set,<br>    after doing so, clang found all the required files and the program ran fine, <br>    without omitting anything.<br><br>I also changed the diagnostics according to what you wrote, <br>    and it's working correctly now.<br>    <br>Thank you for all your help <br><br>    Nir.<br><br><br>----- Original Message -----<br>From: Peter Collingbourne <peter@pcc.me.uk><br>Date: Friday, March 25, 2011 9:51<br>Subject: Re: [cfe-dev] clang omits a part of the code<br>To: Nir Pluderman <nirpl@bgu.ac.il><br>Cc: cfe-dev@cs.uiuc.edu<br><br>> On Fri, Mar 25, 2011 at 11:31:08AM +0000, Nir Pluderman wrote:<br>> > Thank you for your quick response Peter,<br>> > <br>> > I did as you said, and this is the output I got:<br>> > <br>> >     Stack dump:<br>> >     0.    /usr/include/stdio.h:34:3: current parser token 'include'<br>> <br>> This is not a standard diagnostic but part of Clang's output if it<br>> segfaults/asserts.  Since you received the segfault/assert <br>> at the point<br>> where a diagnostic should be emitted, I suspect it is because <br>> you did<br>> not create the Diagnostic object correctly.  This is how I <br>> normallybuild a Diagnostic object and point it to a <br>> TextDiagnosticPrinter(which should just print the diagnostics to <br>> standard error):<br>> <br>>   clang::TextDiagnosticPrinter *DiagClient =<br>>     new clang::TextDiagnosticPrinter(errs(), <br>> clang::DiagnosticOptions());  <br>> IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagID(new <br>> clang::DiagnosticIDs());  clang::Diagnostic *Diag = new <br>> clang::Diagnostic(DiagID, DiagClient);<br>> <br>> > note:<br>> >     In both cases the problematic line in these standard <br>> library headers is: <br>> >         #include <stddef.h><br>> <br>> This means that Clang could not find its stddef.h header, because<br>> HeaderSearchOptions::ResourceDir (i.e. headerSearchOpts->ResourceDir)<br>> was not set correctly.  You should set it to something like<br>> <br>> LLVM_PREFIX "/lib/clang/" CLANG_VERSION_STRING<br>> <br>> where LLVM_PREFIX is your LLVM build directory and <br>> CLANG_VERSION_STRINGis a macro defined in clang/Basic/Version.h.<br>> <br>> Thanks,<br>> -- <br>> Peter<br>> ‎