[cfe-dev] ObjCIvarRefExpr vs. DeclRefExpr

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 20 18:37:03 PDT 2018


On Fri, 20 Jul 2018 at 18:21, George Karpenkov via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
>
> I have stumbled into this curios pattern today: ObjCIvarRefExpr is *not* a
> subclass of DeclRefExpr.
> Does anyone know why is this the case? Anyone against changing this?
>

ObjCIvarRefExpr should not be a subclass of DeclRefExpr. DeclRefExpr is
used to represent cases where a declaration is named directly;
ObjCIvarRefExpr, like MemberExpr, is used to represent naming a decaration
as a member / ivar of another object.

Perhaps ObjCIvarRefExpr and MemberExpr should have a comnon base class, for
member-access-like things, but I can't recall off-hand any places where
that'd really save us much. And you could perhaps make a case that the
"member name" portion of a MemberExpr or ObjCIvarRefExpr should be a
DeclRefExpr, but at this point that would be a lot of churn for little
benefit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180720/d21d7490/attachment-0001.html>


More information about the cfe-dev mailing list