<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 17, 2010, at 5:40 AM, Gaurav Mittal wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><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"><span class="Apple-converted-space"> </span>and branching out.</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><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"><span class="Apple-converted-space"> </span><font face="Consolas">I was looking for more</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><font face="Consolas">information</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><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"><span class="Apple-converted-space"> </span><font face="Consolas">Whether there exists</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><font face="Consolas">a</font></span><span lang="en-us"><font face="Consolas"></font></span><span lang="en-us"><span class="Apple-converted-space"> </span><font face="Consolas">CFG</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><font face="Consolas">API that</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><font face="Consolas">hides the implementation details.</font></span></p></span></blockquote><div>The public methods of the CFG class should be considered as part of its API.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><p dir="LTR"><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"><span class="Apple-converted-space"> </span><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"><span class="Apple-converted-space"> </span>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"><span class="Apple-converted-space"> </span><font face="Consolas">h</font></span><span lang="en-us"><font face="Consolas">ow the symbol tables are</font></span><span lang="en-us"><span class="Apple-converted-space"> </span><font face="Consolas">accessed</font></span><span lang="en-us"><font face="Consolas">, etc.</font></span><span lang="en-us"><font face="Consolas"><span class="Apple-converted-space"> </span>I think this would relate to</font></span><span lang="en-us"><font face="Consolas"><span class="Apple-converted-space"> </span>how the AS</font></span><span lang="en-us"><font face="Consolas">T</font></span><span lang="en-us"><font face="Consolas"><span class="Apple-converted-space"> </span>gets</font></span><span lang="en-us"><font face="Consolas"><span class="Apple-converted-space"> </span>translated to the CFG.</font></span></p><div><br></div></span></blockquote><br></div><div>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.</div><div><br></div><div>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.</div></body></html>