[cfe-commits] r72784 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/objc2-weak-assign.m
Fariborz Jahanian
fjahanian at apple.com
Wed Jun 3 10:15:19 PDT 2009
Author: fjahanian
Date: Wed Jun 3 12:15:17 2009
New Revision: 72784
URL: http://llvm.org/viewvc/llvm-project?rev=72784&view=rev
Log:
Place the GC attribute on the same relative pointer
position to make it consistant and to match gcc's behavior,
by placing it at the inner-most pointer.
Added:
cfe/trunk/test/CodeGenObjC/objc2-weak-assign.m
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=72784&r1=72783&r2=72784&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Jun 3 12:15:17 2009
@@ -828,6 +828,13 @@
if (CanT.getObjCGCAttr() == GCAttr)
return T;
+ if (T->isPointerType()) {
+ QualType Pointee = T->getAsPointerType()->getPointeeType();
+ if (Pointee->isPointerType()) {
+ QualType ResultType = getObjCGCQualType(Pointee, GCAttr);
+ return getPointerType(ResultType);
+ }
+ }
// If we are composing extended qualifiers together, merge together into one
// ExtQualType node.
unsigned CVRQuals = T.getCVRQualifiers();
Added: cfe/trunk/test/CodeGenObjC/objc2-weak-assign.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-weak-assign.m?rev=72784&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-weak-assign.m (added)
+++ cfe/trunk/test/CodeGenObjC/objc2-weak-assign.m Wed Jun 3 12:15:17 2009
@@ -0,0 +1,22 @@
+// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep -e "objc_assign_weak" %t | grep -e "call" | count 6
+
+__weak id* x;
+id* __weak y;
+id* __weak* z;
+
+__weak id* a1[20];
+id* __weak a2[30];
+id** __weak a3[40];
+
+int main()
+{
+ *x = 0;
+ *y = 0;
+ **z = 0;
+
+ a1[3] = 0;
+ a2[3] = 0;
+ a3[3][4] = 0;
+}
+
More information about the cfe-commits
mailing list