[cfe-dev] Fwd: How to check the flow of the clang compiler with an example

kalyan ponnala ponnala.kalyan at gmail.com
Wed Feb 24 17:46:34 PST 2010


---------- Forwarded message ----------
From: kalyan ponnala <ponnala.kalyan at gmail.com>
Date: Wed, Feb 24, 2010 at 8:42 PM
Subject: Re: [cfe-dev] How to check the flow of the clang compiler with an
example
To: Charles Davis <cdavis at mymail.mines.edu>


Thanks for the reply guys. I am able to run those commands correctly (I
guess) but i am not able to see whats going on inside the lexer and parser
as the debugger goes on with the helloworld.c program. I am not sure of what
is happening there as it does not show any output.
I tried these commands:
clang -cc1 -fms-extensions helloworld.c    -----it worked but no output
--nothing happened
clang -cc1 -fsyntax-only helloworld.c -fms-extensions -x c helloworld.c


clang -fsyntax-only helloworld.c -###
etc etc...

I set the breakpoints as you said charles. what more should I do? The .c
file is inside a visual studio project but I am accessing it through the
command line. Is it fine? Do I have to add some commands or paths to the
visual studio project file of helloworld.c ?

Thanks.


On Wed, Feb 24, 2010 at 8:00 PM, Charles Davis <cdavis at mymail.mines.edu>wrote:

> kalyan ponnala wrote:
> >  Hi,
> > Thanks for the reply. I tried putting breakpoints at CIndex.cpp file in
> > CIndex target near
> >
> > Lexer Lex(SourceMgr.getLocForStartOfFile(BeginLocInfo.first),
> >
> >             CXXUnit->getASTContext().getLangOptions(),
> >
> >             Buffer.first, Buffer.first + BeginLocInfo.second,
> > Buffer.second);
> No, no, you want to put the breakpoint on Lexer::Lex(). It's in the
> clangLex target, in Lexer.h.
> >
> > and another breakpoint at Parser.cpp inside clangparser target.
> >
> > bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result) {
> >
> >   Result = DeclGroupPtrTy();
> >
> >   if (Tok.is(tok::eof)) {
> >
> >     Actions.ActOnEndOfTranslationUnit();
> >
> >     return true;
> >
> >   }
> Good.
> >
> > When I tried to run the command clang -cc1 helloworld.c on the command
> > line , it generates 5 diagnostic messages saying error: unknown type
> > __int64 /*64-bit time value*/ and shows me different places inside
> > stdio.h and crtdefs.h.
> That is because you need to also pass -fms-extensions to use clang with
> MS headers.
>
> Chip
>
>


-- 
Kalyan Ponnala
phone: 8163772059



-- 
Kalyan Ponnala
phone: 8163772059
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100224/6fd9b92c/attachment.html>


More information about the cfe-dev mailing list