without a warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128328
91177308-0d34-0410-b5e6-
96231b3b80d8
assert(type);
setObjCGCAttr(type);
}
+ Qualifiers withoutObjCGCAttr() const {
+ Qualifiers qs = *this;
+ qs.removeObjCGCAttr();
+ return qs;
+ }
bool hasAddressSpace() const { return Mask & AddressSpaceMask; }
unsigned getAddressSpace() const { return Mask >> AddressSpaceShift; }
if (lhq.getAddressSpace() != rhq.getAddressSpace())
ConvTy = Sema::IncompatiblePointerDiscardsQualifiers;
+ // It's okay to add or remove GC qualifiers when converting to
+ // and from void*.
+ else if (lhq.withoutObjCGCAttr().compatiblyIncludes(rhq.withoutObjCGCAttr())
+ && (lhptee->isVoidType() || rhptee->isVoidType()))
+ ; // keep old
+
// For GCC compatibility, other qualifier mismatches are treated
// as still compatible in C.
else ConvTy = Sema::CompatiblePointerDiscardsQualifiers;
/* expected-warning {{'__weak' only applies to pointer types; type here is 'int'}}*/ static __we\
ak int i;
+
+// rdar://problem/9126213
+void test2(id __attribute((objc_gc(strong))) *strong,
+ id __attribute((objc_gc(weak))) *weak) {
+ void *opaque;
+ opaque = strong;
+ strong = opaque;
+
+ opaque = weak;
+ weak = opaque;
+}