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
Showing
- docs/AutomaticReferenceCounting.rst 9 additions, 1 deletiondocs/AutomaticReferenceCounting.rst
- lib/Sema/SemaExprObjC.cpp 9 additions, 6 deletionslib/Sema/SemaExprObjC.cpp
- test/ARCMT/nonobjc-to-objc-cast.m 8 additions, 3 deletionstest/ARCMT/nonobjc-to-objc-cast.m
- test/ARCMT/nonobjc-to-objc-cast.m.result 8 additions, 3 deletionstest/ARCMT/nonobjc-to-objc-cast.m.result
- test/SemaObjC/arc-dict-bridged-cast.m 3 additions, 10 deletionstest/SemaObjC/arc-dict-bridged-cast.m
- test/SemaObjC/arc-unbridged-cast.m 7 additions, 0 deletionstest/SemaObjC/arc-unbridged-cast.m
Loading
Please register or sign in to comment