[cfe-commits] r44156 - in /cfe/trunk: Driver/RewriteTest.cpp Sema/SemaExpr.cpp include/clang/AST/Expr.h

Chris Lattner clattner at apple.com
Thu Nov 15 10:21:56 PST 2007

On Nov 15, 2007, at 9:33 AM, Fariborz Jahanian wrote:
>>> --- cfe/trunk/include/clang/AST/Expr.h (original)
>>> +++ cfe/trunk/include/clang/AST/Expr.h Wed Nov 14 20:58:25 2007
>>> @@ -1256,18 +1256,23 @@
>>>  class ObjcIvarDecl *D;
>>>  SourceLocation Loc;
>>>  Expr *Base;
>>> -  bool IsArrow;      // True if this is "X->F", false if this is
>>> "X.F".
>>> +  bool IsArrow:1;      // True if this is "X->F", false if this is
>>> "X.F".
>>> +  bool IsFreeIvar:1;   // True if ivar reference has no base (self
>>> assumed).
>> What is IsFreeIvar used for?  Shouldn't references to fields of the
>> current objects just use a declrefexpr?
> It is ivar reference without the base expressions ('self') is  
> assumed. This is to 'attach' the base during rewrite and also for  
> pretty printing to come out exactly as user wrote the code. Use of  
> declrefexpr probably masks what user wrote.

I assume that this is similar to a C++ example like this:

class foo {
   int x;

   int bar() { return x; }

Why is it more natural to refer to "x" as a field reference than as a  
declref of the FieldDecl?  I know that GCC explicitly does lowering  
when is parses (making this a field reference off the hidden this/ 
self parameter), but that doesn't seem like the right choice for our  



More information about the cfe-commits mailing list