Skip to content

Commit 5b4252a

Browse files
authored
[cxx-interop] Remove code from SwiftifyImport that drops _const-suffix (#79756)
This was introduced in 1405520 in an attempt to be accommodate existing interfaces with the _const scheme, but we shouldn't need to support such textual interfaces anyway since the _const suffix only appears in C++ code (which shouldn't be part of a resilient interface). For newly generated interfaces, dropQualifierSuffix doesn't do anything since the code that generates the suffix is now gone. rdar://143769901
1 parent 4a646b4 commit 5b4252a

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,27 +219,13 @@ func dropQualifierGenerics(_ type: TypeSyntax) -> TypeSyntax {
219219
}
220220
}
221221

222-
// The `const` type qualifier used to be encoded as a `_const` suffix on type
223-
// names (though this causes issues for more complex types). We still drop the
224-
// suffix here for backwards compatibility with older textual interfaces.
225-
func dropQualifierSuffix(_ type: TypeSyntax) -> TypeSyntax {
226-
guard let identifier = type.as(IdentifierTypeSyntax.self) else { return type }
227-
let typename = identifier.name.text
228-
if typename.hasSuffix("_const") {
229-
return TypeSyntax(identifier.with(\.name, TokenSyntax.identifier(
230-
String(typename.dropLast("_const".count))
231-
)))
232-
}
233-
return type
234-
}
235-
236222
// The generated type names for template instantiations sometimes contain
237223
// encoded qualifiers for disambiguation purposes. We need to remove those.
238224
func dropCxxQualifiers(_ type: TypeSyntax) -> TypeSyntax {
239225
if let attributed = type.as(AttributedTypeSyntax.self) {
240226
return dropCxxQualifiers(attributed.baseType)
241227
}
242-
return dropQualifierSuffix(dropQualifierGenerics(type))
228+
return dropQualifierGenerics(type)
243229
}
244230

245231
func getPointerMutability(text: String) -> Mutability? {

0 commit comments

Comments
 (0)