[cfe-dev] Trouble understand DeclContext

David Fontaine via cfe-dev cfe-dev at lists.llvm.org
Mon Feb 6 15:08:49 PST 2017


Hi,


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.


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?


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.


Also, how bad of an idea would it be to change the type hierarchy so more classes inherit DeclContext?


Thanks,

David Fontaine

-----------------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170206/e2b81816/attachment.html>


More information about the cfe-dev mailing list