mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[6.2][StrictMemorySafety] Check the safety of return types of calls
Explanation: There were some scenarios where we could call an unsafe function without marking the expression as unsafe. These affect mostly cases where the function's result is passed to another function or returned. This PR makes sure we always flag functions with unsafe return types, even if their result is not stored anywhere for later use. Issues: rdar://157237301 Original PRs: #83520 Risk: Low, worst case scenario the user has to add redundant unsafe keywords in strict memory safe mode. Testing: Added a compiler test. Reviewers: @DougGregor
This commit is contained in:
committed by
Gabor Horvath
parent
fe4880072e
commit
99f9c318ca
@@ -973,7 +973,7 @@ extension _StringObject {
|
||||
#if _runtime(_ObjC)
|
||||
if largeFastIsConstantCocoa {
|
||||
return unsafe withCocoaObject {
|
||||
_getNSCFConstantStringContentsPointer($0)
|
||||
unsafe _getNSCFConstantStringContentsPointer($0)
|
||||
}
|
||||
}
|
||||
if largeIsCocoa {
|
||||
@@ -989,7 +989,7 @@ extension _StringObject {
|
||||
internal var sharedUTF8: UnsafeBufferPointer<UInt8> {
|
||||
@_effects(releasenone) @inline(never) get {
|
||||
_internalInvariant(largeFastIsShared)
|
||||
let start = self.getSharedUTF8Start()
|
||||
let start = unsafe self.getSharedUTF8Start()
|
||||
return unsafe UnsafeBufferPointer(start: start, count: largeCount)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user