@@ -9192,14 +9192,6 @@ static bool SwiftifiableCAT(const clang::CountAttributedType *CAT) {
9192
9192
return CAT && CountedByExpressionValidator ().Visit (CAT->getCountExpr ());
9193
9193
}
9194
9194
9195
- static bool SwiftifiablePointerType (Type swiftType) {
9196
- // don't try to transform any Swift types that _SwiftifyImport doesn't know how to handle
9197
- Type nonnullType = swiftType->lookThroughSingleOptionalType ();
9198
- PointerTypeKind PTK;
9199
- return nonnullType->isOpaquePointer () ||
9200
- (nonnullType->getAnyPointerElementType (PTK) && PTK != PTK_AutoreleasingUnsafeMutablePointer);
9201
- }
9202
-
9203
9195
void ClangImporter::Implementation::swiftify (FuncDecl *MappedDecl) {
9204
9196
if (!SwiftContext.LangOpts .hasFeature (Feature::SafeInteropWrappers))
9205
9197
return ;
@@ -9233,11 +9225,10 @@ void ClangImporter::Implementation::swiftify(FuncDecl *MappedDecl) {
9233
9225
return false ;
9234
9226
};
9235
9227
SwiftifyInfoPrinter printer (getClangASTContext (), SwiftContext, out);
9236
- Type swiftReturnTy = MappedDecl->getResultInterfaceType ();
9237
9228
bool returnIsStdSpan = registerStdSpanTypeMapping (
9238
- swiftReturnTy , ClangDecl->getReturnType ());
9229
+ MappedDecl-> getResultInterfaceType () , ClangDecl->getReturnType ());
9239
9230
auto *CAT = ClangDecl->getReturnType ()->getAs <clang::CountAttributedType>();
9240
- if (SwiftifiableCAT (CAT) && SwiftifiablePointerType (swiftReturnTy) ) {
9231
+ if (SwiftifiableCAT (CAT)) {
9241
9232
printer.printCountedBy (CAT, SwiftifyInfoPrinter::RETURN_VALUE_INDEX);
9242
9233
attachMacro = true ;
9243
9234
}
@@ -9251,15 +9242,14 @@ void ClangImporter::Implementation::swiftify(FuncDecl *MappedDecl) {
9251
9242
for (auto [index, clangParam] : llvm::enumerate (ClangDecl->parameters ())) {
9252
9243
auto clangParamTy = clangParam->getType ();
9253
9244
auto swiftParam = MappedDecl->getParameters ()->get (index);
9254
- Type swiftParamTy = swiftParam->getInterfaceType ();
9255
9245
bool paramHasBoundsInfo = false ;
9256
9246
auto *CAT = clangParamTy->getAs <clang::CountAttributedType>();
9257
- if (SwiftifiableCAT (CAT) && SwiftifiablePointerType (swiftParamTy) ) {
9247
+ if (SwiftifiableCAT (CAT)) {
9258
9248
printer.printCountedBy (CAT, index);
9259
9249
attachMacro = paramHasBoundsInfo = true ;
9260
9250
}
9261
9251
bool paramIsStdSpan = registerStdSpanTypeMapping (
9262
- swiftParamTy , clangParamTy);
9252
+ swiftParam-> getInterfaceType () , clangParamTy);
9263
9253
paramHasBoundsInfo |= paramIsStdSpan;
9264
9254
9265
9255
bool paramHasLifetimeInfo = false ;
@@ -9270,7 +9260,7 @@ void ClangImporter::Implementation::swiftify(FuncDecl *MappedDecl) {
9270
9260
if (clangParam->hasAttr <clang::LifetimeBoundAttr>()) {
9271
9261
printer.printLifetimeboundReturn (
9272
9262
index, !paramHasBoundsInfo &&
9273
- swiftParamTy ->isEscapable ());
9263
+ swiftParam-> getInterfaceType () ->isEscapable ());
9274
9264
paramHasLifetimeInfo = true ;
9275
9265
returnHasLifetimeInfo = true ;
9276
9266
}
0 commit comments