Hi,<br>Thanks for the reply. I tried putting breakpoints at <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin-top:0in;
        margin-right:0in;
        margin-bottom:10.0pt;
        margin-left:0in;
        line-height:115%;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-size:10.0pt;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        mso-ascii-font-family:Calibri;
        mso-hansi-font-family:Calibri;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style><span style="font-size: 12pt; line-height: 115%; font-family: "Times New Roman","serif";">CIndex.cpp
file in CIndex target</span> near<br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin-top:0in;
        margin-right:0in;
        margin-bottom:10.0pt;
        margin-left:0in;
        line-height:115%;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-size:10.0pt;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        mso-ascii-font-family:Calibri;
        mso-hansi-font-family:Calibri;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";">Lexer
Lex(SourceMgr.getLocForStartOfFile(BeginLocInfo.first),</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style="">           
</span>CXXUnit->getASTContext().getLangOptions(),</span></p>

<p class="MsoNormal"><span style="font-size: 10pt; line-height: 115%; font-family: "Courier New";"><span style="">           
</span>Buffer.first, Buffer.first + BeginLocInfo.second, Buffer.second);</span></p>

and another breakpoint at Parser.cpp inside clangparser target.<br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5CKalyan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin-top:0in;
        margin-right:0in;
        margin-bottom:10.0pt;
        margin-left:0in;
        line-height:115%;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-size:10.0pt;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        mso-ascii-font-family:Calibri;
        mso-hansi-font-family:Calibri;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New"; color: blue;">bool</span><span style="font-size: 10pt; font-family: "Courier New";">
Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result) {</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style="">  </span>Result = DeclGroupPtrTy();</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style="">  </span><span style="color: blue;">if</span>
(Tok.is(tok::eof)) {</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style="">    </span>Actions.ActOnEndOfTranslationUnit();</span></p>

<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style="">    </span><span style="color: blue;">return</span> <span style="color: blue;">true</span>;</span></p>


<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: "Courier New";"><span style="">  </span>}</span></p>

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.<br>
The program that I created in visual studio was helloworld.c<br><br>#include<stdio.h><br>int main()<br>{<br>printf("\n helloworld");<br>return 0;<br>}<br><br>Could you tell me if the procedure that I used was wrong or is it something with the breakpoints or something else?<br>
<br>Thanks<br><br><div class="gmail_quote">On Wed, Feb 24, 2010 at 5:31 PM, Charles Davis <span dir="ltr"><<a href="mailto:cdavis@mymail.mines.edu">cdavis@mymail.mines.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">kalyan ponnala wrote:<br>
> Hi,<br>
> I would like to go through the clang compiler (the lexer and the parser)<br>
> by compiling a small program like helloworld.c . I am using visual<br>
> studio 2008 solution file for clang/llvm. Can an expert tell me how to<br>
> proceed and the steps that I need to know to do this.<br>
> I am not able to figure out what is the starting program that does the<br>
> lexer and parser stages of the compiler, so that I could put some<br>
> breakpoints that will be hit when we try to compile a program like<br>
> helloworld.<br>
> And I would like to know whats a "cc1". I found it in the code at<br>
> several places.<br>
</div></div>'cc1' is the actual compiler. It's actually a part of clang.exe, but you<br>
activate it with the '-cc1' switch. What you want to do is debug<br>
clang.exe, but pass it the -cc1 so you can debug the compiler itself. If<br>
you don't pass -cc1, you'll start the driver instead, which spawns the<br>
compiler. You can get around that by debugging child processes, too, but<br>
I think it's easier to just run clang -cc1.<br>
<br>
There is a "Lexer" class which is used to read tokens from a source<br>
file, and a "Parser" class which does the parsing. There's also a<br>
"Preprocessor" object which handles preprocessor directives.<br>
<br>
The important method in the Lexer class is the Lex() method. It<br>
retrieves the next token. The parser calls this method every time it<br>
wants a token.<br>
<br>
The Parser object starts by parsing top-level declarations (i.e. ones at<br>
global scope), which is initiated with the ParseTopLevelDecl() method.<br>
<br>
If you set breakpoints on these methods, you can step through the Lexer<br>
and Parser at your leisure.<br>
<br>
Chip<br>
</blockquote></div><br><br clear="all"><br>-- <br>Kalyan Ponnala<br>phone: 8163772059<br>