[cfe-dev] [PATCH]: Parsing for C++ classes
clattner at apple.com
Fri Jun 20 13:12:10 PDT 2008
On Jun 20, 2008, at 11:13 AM, Eli Friedman wrote:
> In Sema::ActOnIdentifierExpr:
> + // FIXME: Should this use a new expr for a direct reference,
> instead of
> + // turning it into "this->field" ? Or else a MemberExpr with
> null base ?
> + ExprResult ThisExpr = ActOnCXXThis(Loc);
> + return new MemberExpr(static_cast<Expr*>(ThisExpr.Val),
> + true, FD, Loc, FD->getType());
> I'd say this is fine, except that you should use an empty
> SourceLocation for the artificial "this" so it's distinguishable from
> a real MemberExpr. clang currently uses this technique for
> initializer lists.
Great catch. I'd strongly prefer to represent "field" and "this-
>field" differently. The former should be a DeclRefExpr and the
later should be a member expr. We are still trying to untangle the
ObjC front-end from this early mistake.
More information about the cfe-dev