[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 14:09:49 PST 2009


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,

-Chris 



More information about the cfe-commits mailing list