[cfe-commits] r61885 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/StmtPrinter.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp
Chris Lattner
clattner at apple.com
Wed Jan 7 20:50:44 PST 2009
On Jan 7, 2009, at 2:09 PM, Chris Lattner wrote:
> On Jan 7, 2009, at 1:59 PM, Douglas Gregor wrote:
>> I really think this should be some form of MemberExpr (or subclass
>> thereof), because both semantic analysis and codegen need to treat
>> these as member expressions, and we don't want to push those clients
>> into dealing with ImplicitThisFieldDeclRefExpr or
>> ImplicitAnonStructUnionFieldRefExpr separately. Plus, we may need to
>> introduce implicit casts on "this" to turn it into a base class
>> pointer, and we need somewhere in the AST to store them.
>>
>> My patch isn't right, though. The "Implicit" flag should really only
>> occur in MemberExpr, not all the way up in Expr, and MemberExpr can
>> use that to get the source ranges correct.
>
> Okay, another option would be to have something like:
>
> MemberExpr
> -> ImplicitThisMemberExpr
> -> ExplicitBaseMemberExpr
>
> In the end, I think I'd prefer having an 'implicit this/self' bit in
> MemberExpr. That sounds much better than an implicit bit on expr,
FWIW, Doug convinced me off-line that it's best to just add a 'is
implicit' bit in MemberExpr. In member references to virtual base
classes, we really do want the base to be present so we have a place
to put the implicit conversion of "this" to the base class.
-Chris
More information about the cfe-commits
mailing list