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