<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-02-07 6:08 GMT+07:00 David Fontaine via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:calibri,arial,helvetica,sans-serif">
<p>Hi,<br>
</p>
<p><br>
</p>
<p>I'm having trouble understanding the semantics of DeclContext.  The documentation on this class (as of 3.9) refers to "declaration contexts" which it does not define and which does not seem to be a concept from the standard.<br>
</p>
<p><br>
</p>
<p>How was it determined which classes should inherit DeclContext?  When should a nested DeclContext be added and when is it okay to use an existing DeclContext?<br>
</p>
<p><br></p></div></blockquote><div>The DeclContext is a declaration that is a container for other declarations. All non-leaf nodes of AST inherit it. If a contained declaration itself can contain other declarations (nested class, method of a class etc), it will be a nested DeclContext.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:calibri,arial,helvetica,sans-serif"><p>
</p>
<p>For example, DeclContext cannot correspond directly to declarative regions as defined in [basic.scope.declarative] (3.3.1) because only Decl subtypes inherit it.  A block, for example, is something that opens a new region, and in the AST it is a CompoundStmt, which
 is not a Decl.<br>
</p>
<p><br></p></div></blockquote><div><span style="font-family:calibri;font-size:11pt">Declarative
regions contained in expressions, like CompoundStmt, are organized using Scope
objects. However Scope is a parser notion, and is not represented in AST.</span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:calibri,arial,helvetica,sans-serif"><p>
</p>
<p>Also, how bad of an idea would it be to change the type hierarchy so more classes inherit DeclContext?<br>
</p>
<p><br>
</p>
<p>Thanks,<br>
</p>
<p>David Fontaine<br>
</p>

<div>
<hr>
</div>
<div>This email message is for the sole use of the intended recipient(s) and may 
contain confidential information.  Any unauthorized review, use, disclosure 
or distribution is prohibited.  If you are not the intended recipient, 
please contact the sender by reply email and destroy all copies of the original 
message. </div>
<div>
<hr>
</div>
</div>

<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>