[cfe-commits] r69435 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenObjC/attr-strong.c

Daniel Dunbar daniel at zuster.org
Sat Apr 18 01:54:43 PDT 2009


Author: ddunbar
Date: Sat Apr 18 03:54:40 2009
New Revision: 69435

URL: http://llvm.org/viewvc/llvm-project?rev=69435&view=rev
Log:
Use getAsPointerType instead of using getCanonicalType directly.
 - <rdar://problem/6803995>

Added:
    cfe/trunk/test/CodeGenObjC/attr-strong.c
Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Apr 18 03:54:40 2009
@@ -825,13 +825,10 @@
                                                     BaseTypeSize));
   }
   
-  QualType T = E->getBase()->getType();
-  QualType ExprTy = getContext().getCanonicalType(T);
-  T = T->getAsPointerType()->getPointeeType();
-  LValue LV = 
-           LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"),
-           ExprTy->getAsPointerType()->getPointeeType().getCVRQualifiers(),
-           getContext().getObjCGCAttrKind(T));
+  QualType T = E->getBase()->getType()->getAsPointerType()->getPointeeType();
+  LValue LV = LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"),
+                               T.getCVRQualifiers(),
+                               getContext().getObjCGCAttrKind(T));
   if (getContext().getLangOptions().ObjC1 &&
       getContext().getLangOptions().getGCMode() != LangOptions::NonGC)
     LValue::SetObjCNonGC(LV, !E->isOBJCGCCandidate());
@@ -900,7 +897,7 @@
   if (E->isArrow()) {
     BaseValue = EmitScalarExpr(BaseExpr);
     const PointerType *PTy = 
-      cast<PointerType>(getContext().getCanonicalType(BaseExpr->getType()));
+      BaseExpr->getType()->getAsPointerType();
     if (PTy->getPointeeType()->isUnionType())
       isUnion = true;
     CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
@@ -1166,8 +1163,7 @@
   QualType ObjectTy;
   if (E->isArrow()) {
     BaseValue = EmitScalarExpr(BaseExpr);
-    const PointerType *PTy = 
-      cast<PointerType>(getContext().getCanonicalType(BaseExpr->getType()));
+    const PointerType *PTy = BaseExpr->getType()->getAsPointerType();
     ObjectTy = PTy->getPointeeType();
     CVRQualifiers = ObjectTy.getCVRQualifiers();
   } else {

Added: cfe/trunk/test/CodeGenObjC/attr-strong.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/attr-strong.c?rev=69435&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/attr-strong.c (added)
+++ cfe/trunk/test/CodeGenObjC/attr-strong.c Sat Apr 18 03:54:40 2009
@@ -0,0 +1,9 @@
+// RUN: clang -emit-llvm -S -o %t %s
+
+struct s0 {
+  void *a;
+};
+struct s0 * __attribute__((objc_gc(strong))) g0;
+void f0(void) {
+  g0->a = 0;
+}





More information about the cfe-commits mailing list