[Swiftify] Don't drop bounds checks when mixing std::span and counted_by

When an imported function combines std::span and __counted_by,
std::span would override bounds checks emitted for __counted_by (if it
occurred later in the the parameter list) resulting in no bounds checks
being emitted.

rdar://147883384
This commit is contained in:
Henrik G. Olsson
2025-03-25 17:06:01 -07:00
parent 98d6480ddb
commit c7af94ba07
2 changed files with 22 additions and 3 deletions

View File

@@ -411,7 +411,7 @@ struct CxxSpanThunkBuilder: ParamPointerBoundsThunkBuilder {
let isSizedBy: Bool = false
func buildBoundsChecks() throws -> [CodeBlockItemSyntax.Item] {
return []
return try base.buildBoundsChecks()
}
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
@@ -447,7 +447,7 @@ struct CxxSpanReturnThunkBuilder: BoundsCheckedThunkBuilder {
public let node: SyntaxProtocol
func buildBoundsChecks() throws -> [CodeBlockItemSyntax.Item] {
return []
return try base.buildBoundsChecks()
}
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws