[cfe-commits] r81244 - in /cfe/trunk: include/clang/AST/Type.h test/CodeGenObjC/objc2-strong-cast-4.m

Fariborz Jahanian fjahanian at apple.com
Tue Sep 8 12:45:48 PDT 2009


Author: fjahanian
Date: Tue Sep  8 14:45:47 2009
New Revision: 81244

URL: http://llvm.org/viewvc/llvm-project?rev=81244&view=rev
Log:
Fixes a regression in generating objc's GC API
in assiging to c pointer types with a GC'able
attribute.

Added:
    cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m
Modified:
    cfe/trunk/include/clang/AST/Type.h

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=81244&r1=81243&r2=81244&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Sep  8 14:45:47 2009
@@ -2235,6 +2235,9 @@
     return EXTQT->getObjCGCAttr();
   if (const ObjCObjectPointerType *PT = CT->getAsObjCObjectPointerType())
     return PT->getPointeeType().getObjCGCAttr(); 
+  // We most look at all pointer types, not just pointer to interface types.
+  if (const PointerType *PT = CT->getAs<PointerType>())
+    return PT->getPointeeType().getObjCGCAttr(); 
   return GCNone;
 }
 

Added: cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m?rev=81244&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m (added)
+++ cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m Tue Sep  8 14:45:47 2009
@@ -0,0 +1,23 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_assign_strongCast %t | count 3 &&
+// RUN: true
+
+struct Slice {
+    void *__strong * items;
+};
+
+typedef struct Slice Slice;
+
+ at interface ISlice {
+ at public
+    void *__strong * items;
+}
+ at end
+
+void foo () {
+    Slice *slice;
+    slice->items = 0;
+
+    ISlice *islice;
+    islice->items = 0;
+}





More information about the cfe-commits mailing list