<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 08.00.0681.000">
<TITLE>RE: [cfe-dev] CFG documentation</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Hi Ted,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Thanks for the link. I had actually already gone through all the documentation online and am currently sifting through the source code starting at cfg.h</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"> and branching out.</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">I think using the command line to dump the CFG will help get a jump start, thanks. </FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Through my posting on the mailing list</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">I was looking for more</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">information</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">on</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">:</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">1</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">.</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">Whether there exists</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">a</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"></FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">CFG</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">API that</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">hides the implementation details.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">2</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">. The CFG</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">structure and how it relates/uses the AST</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">.</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"> E.g. how would one lookup the nature of a variable in an expression or its scop</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">e</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">,</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"></FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">h</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">ow the symbol tables are</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Consolas">accessed</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">, etc.</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"> I think this would relate to</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"> how the AS</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas">T</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"> gets</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Consolas"> translated to the CFG.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Regards,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Gaurav</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">-----Original Message-----<BR>
From: Ted Kremenek [<A HREF="mailto:kremenek@apple.com">mailto:kremenek@apple.com</A>]<BR>
Sent: Thursday, December 16, 2010 6:48 PM<BR>
To: gaurav@binachip.com<BR>
Cc: cfe-dev@cs.uiuc.edu<BR>
Subject: Re: [cfe-dev] CFG documentation</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Hi Gaurav,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">There is some documentation on the CFG here:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">  <A HREF="http://clang.llvm.org/docs/InternalsManual.html#CFG">http://clang.llvm.org/docs/InternalsManual.html#CFG</A></FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">It's a bit dated, but it explains the core concepts of how the CFG is represented.  The CFG has recently been expanded so that it can contain other elements besides just Stmt*, but the design is still the same.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">Note that you can dump CFGs from the command line:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">$ clang -fsyntax-only -Xclang -analyze -Xclang -dump-cfg t.c</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">On Dec 15, 2010, at 9:25 AM, Gaurav Mittal wrote:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> Hi folks,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> I'm trying to hack CLANG to translate its Control Flow Graph (CFG) to the</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> native CFG for my own tool -- essentially use CLANG as a frontend (and</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> possibly more) to a pre-existing tool. Does anybody have any documentation</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> on the CLANG control flow graph other than the doxygen stuff? I would really</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> appreciate any pointers on where to start.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> </FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> Regards,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> Gaurav</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> </FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> </FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> _______________________________________________</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> cfe-dev mailing list</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> cfe-dev@cs.uiuc.edu</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Consolas">> <A HREF="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</A></FONT></SPAN></P>
<BR>

</BODY>
</HTML>