Fixes a regression in generating objc's GC API

in assiging to c pointer types with a GC'able
attribute.

llvm-svn: 81244
This commit is contained in:
Fariborz Jahanian 2009-09-08 19:45:47 +00:00
parent 10ff0c1862
commit b17a190186
2 changed files with 26 additions and 0 deletions

View File

@ -2235,6 +2235,9 @@ inline QualType::GCAttrTypes QualType::getObjCGCAttr() const {
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;
}

View File

@ -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;
@interface ISlice {
@public
void *__strong * items;
}
@end
void foo () {
Slice *slice;
slice->items = 0;
ISlice *islice;
islice->items = 0;
}