[llvm-branch-commits] [cfe-branch] r81291 - in /cfe/branches/Apple/Dib: lib/AST/Expr.cpp test/CodeGenObjC/objc2-strong-cast-4.m
Fariborz Jahanian
fjahanian at apple.com
Tue Sep 8 16:59:03 PDT 2009
Author: fjahanian
Date: Tue Sep 8 18:59:03 2009
New Revision: 81291
URL: http://llvm.org/viewvc/llvm-project?rev=81291&view=rev
Log:
Brought in patch for radar 7200620 from the mainline.
Added:
cfe/branches/Apple/Dib/test/CodeGenObjC/objc2-strong-cast-4.m
Modified:
cfe/branches/Apple/Dib/lib/AST/Expr.cpp
Modified: cfe/branches/Apple/Dib/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/AST/Expr.cpp?rev=81291&r1=81290&r2=81291&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/AST/Expr.cpp (original)
+++ cfe/branches/Apple/Dib/lib/AST/Expr.cpp Tue Sep 8 18:59:03 2009
@@ -923,7 +923,7 @@
}
/// isOBJCGCCandidate - Check if an expression is objc gc'able.
-///
+/// returns true, if it is; false otherwise.
bool Expr::isOBJCGCCandidate(ASTContext &Ctx) const {
switch (getStmtClass()) {
default:
@@ -945,11 +945,8 @@
if (VD->hasGlobalStorage())
return true;
QualType T = VD->getType();
- // dereferencing to an object pointer is always a gc'able candidate
- if (T->isPointerType() &&
- Ctx.isObjCObjectPointerType(T->getAsPointerType()->getPointeeType()))
- return true;
-
+ // dereferencing to pointer is always a gc'able candidate
+ return T->isPointerType();
}
return false;
}
Added: cfe/branches/Apple/Dib/test/CodeGenObjC/objc2-strong-cast-4.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/CodeGenObjC/objc2-strong-cast-4.m?rev=81291&view=auto
==============================================================================
--- cfe/branches/Apple/Dib/test/CodeGenObjC/objc2-strong-cast-4.m (added)
+++ cfe/branches/Apple/Dib/test/CodeGenObjC/objc2-strong-cast-4.m Tue Sep 8 18:59:03 2009
@@ -0,0 +1,35 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_assign_strongCast %t | count 7 &&
+// RUN: true
+
+struct Slice {
+ void *__strong * items;
+};
+
+typedef struct Slice Slice;
+
+ at interface ISlice {
+ at public
+ void *__strong * IvarItem;
+}
+ at end
+
+void foo (int i) {
+ // storing into an array of strong pointer types.
+ void *__strong* items;
+ items[i] = 0;
+
+ // storing indirectly into an array of strong pointer types.
+ void *__strong* *vitems;
+ *vitems[i] = 0;
+
+ Slice *slice;
+ slice->items = 0;
+ // storing into a struct element of an array of strong pointer types.
+ slice->items[i] = 0;
+
+ ISlice *islice;
+ islice->IvarItem = 0;
+ // Storing into an ivar of an array of strong pointer types.
+ islice->IvarItem[i] = (void*)0;
+}
More information about the llvm-branch-commits
mailing list