]> granicus.if.org Git - clang/commitdiff
local array of objects are non-gc'able.
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 21 Feb 2009 23:37:19 +0000 (23:37 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 21 Feb 2009 23:37:19 +0000 (23:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65251 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index a9db6db0d9b6c6f72e2c58c2f96e30ee1064c936..2348a11f7b0d8f1ab9c8a43d145d8327b35fd46d 100644 (file)
@@ -776,10 +776,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
   QualType T = E->getBase()->getType();
   QualType ExprTy = getContext().getCanonicalType(T);
   T = T->getAsPointerType()->getPointeeType();
-
-  return LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"),
+  LValue LV = 
+           LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"),
            ExprTy->getAsPointerType()->getPointeeType().getCVRQualifiers(),
            getContext().getObjCGCAttrKind(T));
+  if (getContext().getLangOptions().ObjC1 &&
+      getContext().getLangOptions().getGCMode() != LangOptions::NonGC)
+    LValue::SetObjCNonGC(LV, !E->hasGlobalStorage());
+  return LV;
 }
 
 static