@@ -8820,6 +8820,8 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
88208820namespace {
88218821class SwiftifyInfoPrinter {
88228822public:
8823+ static const ssize_t SELF_PARAM_INDEX = -2 ;
8824+ static const ssize_t RETURN_VALUE_INDEX = -1 ;
88238825 clang::ASTContext &ctx;
88248826 llvm::raw_ostream &out;
88258827 bool firstParam = true ;
@@ -8891,9 +8893,9 @@ class SwiftifyInfoPrinter {
88918893 }
88928894
88938895 void printParamOrReturn (ssize_t pointerIndex) {
8894- if (pointerIndex == - 2 )
8896+ if (pointerIndex == SELF_PARAM_INDEX )
88958897 out << " .self" ;
8896- else if (pointerIndex == - 1 )
8898+ else if (pointerIndex == RETURN_VALUE_INDEX )
88978899 out << " .return" ;
88988900 else
88998901 out << " .param(" << pointerIndex + 1 << " )" ;
@@ -8935,16 +8937,17 @@ void ClangImporter::Implementation::swiftify(FuncDecl *MappedDecl) {
89358937 MappedDecl->getResultInterfaceType (), ClangDecl->getReturnType ());
89368938 if (auto CAT =
89378939 ClangDecl->getReturnType ()->getAs <clang::CountAttributedType>()) {
8938- printer.printCountedBy (CAT, - 1 );
8940+ printer.printCountedBy (CAT, SwiftifyInfoPrinter::RETURN_VALUE_INDEX );
89398941 attachMacro = true ;
89408942 }
89418943 bool returnHasLifetimeInfo = false ;
8942- bool lifetimeDependenceOn = MappedDecl-> getASTContext (). LangOpts . hasFeature (
8943- Feature::LifetimeDependence);
8944+ bool lifetimeDependenceOn =
8945+ SwiftContext. LangOpts . hasFeature ( Feature::LifetimeDependence);
89448946 if (SwiftDeclConverter::getImplicitObjectParamAnnotation<
89458947 clang::LifetimeBoundAttr>(ClangDecl) &&
89468948 lifetimeDependenceOn) {
8947- printer.printLifetimeboundReturn (-2 , true );
8949+ printer.printLifetimeboundReturn (SwiftifyInfoPrinter::SELF_PARAM_INDEX,
8950+ true );
89488951 returnHasLifetimeInfo = true ;
89498952 }
89508953 for (auto [index, clangParam] : llvm::enumerate (ClangDecl->parameters ())) {
0 commit comments