diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-08 19:45:47 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-08 19:45:47 +0000 |
| commit | b17a190186c8bc07e304b69b29bd241d8cfc6c92 (patch) | |
| tree | b6f7573833c71e1638606d5ac08741c4de70d810 | |
| parent | 10ff0c1862e07d892d75b53eb6264f7edb31236f (diff) | |
| download | bcm5719-llvm-b17a190186c8bc07e304b69b29bd241d8cfc6c92.tar.gz bcm5719-llvm-b17a190186c8bc07e304b69b29bd241d8cfc6c92.zip | |
Fixes a regression in generating objc's GC API
in assiging to c pointer types with a GC'able
attribute.
llvm-svn: 81244
| -rw-r--r-- | clang/include/clang/AST/Type.h | 3 | ||||
| -rw-r--r-- | clang/test/CodeGenObjC/objc2-strong-cast-4.m | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index f46227d85fa..4cebdcdf212 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -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; } diff --git a/clang/test/CodeGenObjC/objc2-strong-cast-4.m b/clang/test/CodeGenObjC/objc2-strong-cast-4.m new file mode 100644 index 00000000000..e351f484770 --- /dev/null +++ b/clang/test/CodeGenObjC/objc2-strong-cast-4.m @@ -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; +} |

