]> granicus.if.org Git - clang/commit
Allow (Object *)kMyGlobalCFObj casts without bridging
authorBen Langmuir <blangmuir@apple.com>
Wed, 25 Feb 2015 20:09:06 +0000 (20:09 +0000)
committerBen Langmuir <blangmuir@apple.com>
Wed, 25 Feb 2015 20:09:06 +0000 (20:09 +0000)
commitb378995a9f641f1bb51f2a6b0f4fde18ad4ab916
tree4aecd804f13881ba310be48cded7f1b613f2509a
parent3cd9f9f0549506f591c0b0e260e244d3c58004ed
Allow (Object *)kMyGlobalCFObj casts without bridging

Previously we allowed these casts only for constants declared in system
headers, which we assume are retain/release-neutral. Now also allow them
for constants in user headers, treating them as +0.  Practically, this
means that we will now allow:
id x = (id)kMyGlobalConst;

But unlike with system headers we cannot mix them with +1 values:
id y = (id)(b ? kMyGlobalConst : [Obj newValAtPlusOne]); // error
id z = (id)(b ? kSystemGlobalConst: [Obj newValAtPlusOne]); // OK

Thanks to John for suggesting this improvement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230534 91177308-0d34-0410-b5e6-96231b3b80d8
docs/AutomaticReferenceCounting.rst
lib/Sema/SemaExprObjC.cpp
test/ARCMT/nonobjc-to-objc-cast.m
test/ARCMT/nonobjc-to-objc-cast.m.result
test/SemaObjC/arc-dict-bridged-cast.m
test/SemaObjC/arc-unbridged-cast.m