forked from OSchip/llvm-project
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. llvm-svn: 72784
This commit is contained in:
parent
2f04887220
commit
b68215c4de
|
@ -828,6 +828,13 @@ QualType ASTContext::getObjCGCQualType(QualType T,
|
||||||
if (CanT.getObjCGCAttr() == GCAttr)
|
if (CanT.getObjCGCAttr() == GCAttr)
|
||||||
return T;
|
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
|
// If we are composing extended qualifiers together, merge together into one
|
||||||
// ExtQualType node.
|
// ExtQualType node.
|
||||||
unsigned CVRQuals = T.getCVRQualifiers();
|
unsigned CVRQuals = T.getCVRQualifiers();
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue