]> granicus.if.org Git - clang/commitdiff
Non-pointer objects are none gc'able regardles of
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 11 Apr 2009 00:00:54 +0000 (00:00 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 11 Apr 2009 00:00:54 +0000 (00:00 +0000)
the attribute set on them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68844 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/CodeGenObjC/objc2-no-strong-cast.m [new file with mode: 0644]

index 25ab97e7c7ecd2d8aa7098844490e4ad2ee6fa5a..ac69a38c3dcf2423780ce22b1e324f6254e22b98 100644 (file)
@@ -2694,6 +2694,10 @@ QualType::GCAttrTypes ASTContext::getObjCGCAttrKind(const QualType &Ty) const {
       else if (Ty->isPointerType())
         return getObjCGCAttrKind(Ty->getAsPointerType()->getPointeeType());
     }
+    // Non-pointers have none gc'able attribute regardless of the attribute
+    // set on them.
+    else if (!isObjCObjectPointerType(Ty) && !Ty->isPointerType())
+      return QualType::GCNone;
   }
   return GCAttrs;
 }
diff --git a/test/CodeGenObjC/objc2-no-strong-cast.m b/test/CodeGenObjC/objc2-no-strong-cast.m
new file mode 100644 (file)
index 0000000..bce50cd
--- /dev/null
@@ -0,0 +1,22 @@
+// RUN: clang-cc -emit-llvm -o %t %s
+
+@interface PDFViewPrivateVars 
+{
+@public
+       __attribute__((objc_gc(strong))) char *addedTooltips;
+}
+@end
+
+@interface PDFView 
+{
+    PDFViewPrivateVars *_pdfPriv;
+}
+@end
+
+@implementation PDFView
+- (void) addTooltipsForPage
+{
+ _pdfPriv->addedTooltips[4] = 1;
+}
+@end
+