]> granicus.if.org Git - clang/commitdiff
Fields of ivars of struct types are considered ivars
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 21 Nov 2008 18:14:01 +0000 (18:14 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 21 Nov 2008 18:14:01 +0000 (18:14 +0000)
themselves for gc API generation purposes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGValue.h

index 21ac806c62422861c3d3d0e24f21b8108455c17a..4f2bd4871b81b2844adf3909026f462f1a0ab847 100644 (file)
@@ -732,6 +732,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
 
 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 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
   }
   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 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
   }
 
   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 @@ LValue CodeGenFunction::EmitLValueForIvar(llvm::Value *BaseValue,
   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;
 }
 
index 3cf5d4a7d93cf6c6b5631c344ca6b6083d969e47..59cfc54c9d806aad31f5f3786f2ee367ae3f600f 100644 (file)
@@ -168,8 +168,8 @@ public:
   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) {