[cfe-commits] r59828 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CGValue.h

Fariborz Jahanian fjahanian at apple.com
Fri Nov 21 10:14:13 PST 2008


Author: fjahanian
Date: Fri Nov 21 12:14:01 2008
New Revision: 59828

URL: http://llvm.org/viewvc/llvm-project?rev=59828&view=rev
Log:
Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGValue.h

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=59828&r1=59827&r2=59828&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Nov 21 12:14:01 2008
@@ -732,6 +732,7 @@
 
 LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
   bool isUnion = false;
+  bool isIvar = false;
   Expr *BaseExpr = E->getBase();
   llvm::Value *BaseValue = NULL;
   unsigned CVRQualifiers=0;
@@ -747,6 +748,8 @@
   }
   else {
     LValue BaseLV = EmitLValue(BaseExpr);
+    if (BaseLV.isObjCIvar())
+      isIvar = true;
     // FIXME: this isn't right for bitfields.
     BaseValue = BaseLV.getAddress();
     if (BaseExpr->getType()->isUnionType())
@@ -755,7 +758,9 @@
   }
 
   FieldDecl *Field = E->getMemberDecl();
-  return EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers);
+  LValue MemExpLV =  EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers);
+  LValue::SetObjCIvar(MemExpLV, isIvar);
+  return MemExpLV;
 }
 
 LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
@@ -937,7 +942,7 @@
   llvm::Value *V = Builder.CreateStructGEP(BaseValue, Index, "tmp");
   LValue LV = LValue::MakeAddr(V, Ivar->getType().getCVRQualifiers()|CVRQualifiers);
   SetVarDeclObjCAttribute(getContext(), Ivar, Ivar->getType(), LV);
-  LValue::SetObjCIvar(LV);
+  LValue::SetObjCIvar(LV, true);
   return LV;
 }
 

Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=59828&r1=59827&r2=59828&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Fri Nov 21 12:14:01 2008
@@ -168,8 +168,8 @@
   bool isObjCWeak() const { return ObjCType == Weak; }
   bool isObjCStrong() const { return ObjCType == Strong; }
   
-  static void SetObjCIvar(LValue& R) {
-    R.Ivar = true;
+  static void SetObjCIvar(LValue& R, bool iValue) {
+    R.Ivar = iValue;
   }
     
   static void SetObjCType(bool isWeak, bool isStrong, LValue& R) {





More information about the cfe-commits mailing list