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

Charles Davis cdavis at mymail.mines.edu
Wed Feb 24 17:00:01 PST 2010


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




More information about the cfe-dev mailing list