<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Ted,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the explanation. After a brief chat with someone who explored using LLVM for a slightly different purpose, I have determined that I might be barking up the wrong tree. Maybe I should be looking at the LLVM assembly language instead since it maintains type information anyway and should be easier to convert to my tool’s native CDFG.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gaurav<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Ted Kremenek [mailto:kremenek@apple.com] <br><b>Sent:</b> Friday, December 17, 2010 10:34 AM<br><b>To:</b> gaurav@binachip.com<br><b>Cc:</b> cfe-dev@cs.uiuc.edu<br><b>Subject:</b> Re: [cfe-dev] CFG documentation<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Dec 17, 2010, at 5:40 AM, Gaurav Mittal wrote:<o:p></o:p></p></div><p class=MsoNormal><br><br><o:p></o:p></p><p><span style='font-size:13.5pt;font-family:Consolas'>Hi Ted,</span><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:13.5pt;font-family: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<span class=apple-converted-space> </span>and branching out.</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>I think using the command line to dump the CFG will help get a jump start, thanks.</span><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:13.5pt;font-family:Consolas'>Through my posting on the mailing list</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>I was looking for more</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>information</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>on:</span><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:13.5pt;font-family:Consolas'>1.</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>Whether there exists</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>a</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>CFG</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>API that</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>hides the implementation details.</span><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><o:p></o:p></span></p><div><p class=MsoNormal>The public methods of the CFG class should be considered as part of its API.<o:p></o:p></p></div><p class=MsoNormal><br><br><o:p></o:p></p><p><span style='font-size:13.5pt;font-family:Consolas'>2. The CFG</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>structure and how it relates/uses the AST.<span class=apple-converted-space> </span>E.g. how would one lookup the nature of a variable in an expression or its scope,</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>how the symbol tables are</span><span class=apple-converted-space><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'> </span></span><span style='font-size:13.5pt;font-family:Consolas'>accessed, etc.<span class=apple-converted-space> </span>I think this would relate to<span class=apple-converted-space> </span>how the AST<span class=apple-converted-space> </span>gets<span class=apple-converted-space> </span>translated to the CFG.</span><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><o:p> </o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I think some of your questions more have to do with how some fundamental concepts are represented in Clang in general.  The CFG simply models a control-flow relation between elements (i.e., statements and expressions) in the AST, no more and no less.  It does not encapsulate scope or reason about anything else except statements and expressions.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The AST encapsulates statements, expressions, and declarations.  There is no symbol table per se in the Clang frontend, as all symbols are uniquely identified by their (canonical) declarations.  The LLVM backend reasons about symbols differently since that represents a strictly low-level representation of the program.  Scope is currently not modeled explicitly in the AST, but it can be inferred.  The parser and semantic analyzer reason about scope while building the AST, but that information is not recorded in the AST.<o:p></o:p></p></div></div></body></html>