Skip to content

Commit 80e6466

Browse files
authored
[ClangImporter] importMethodType -> importMethodParamsAndReturnType (swiftlang#27349)
And similar for importFunctionParamsAndReturnType and importAccessorParamsAndReturnType. In all cases the return type isn't a FunctionType, and there's also a ParameterList out-parameter. No functionality change.
1 parent c6c1573 commit 80e6466

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,7 +3724,7 @@ namespace {
37243724
} else {
37253725
// Import the function type. If we have parameters, make sure their
37263726
// names get into the resulting function type.
3727-
importedType = Impl.importFunctionType(
3727+
importedType = Impl.importFunctionParamsAndReturnType(
37283728
dc, decl, {decl->param_begin(), decl->param_size()},
37293729
decl->isVariadic(), isInSystemModule(dc), name, bodyParams);
37303730

@@ -4288,10 +4288,11 @@ namespace {
42884288
prop->getSetterMethodDecl() != decl)
42894289
return nullptr;
42904290
importedType =
4291-
Impl.importAccessorMethodType(dc, prop, decl, isInSystemModule(dc),
4292-
importedName, &bodyParams);
4291+
Impl.importAccessorParamsAndReturnType(dc, prop, decl,
4292+
isInSystemModule(dc),
4293+
importedName, &bodyParams);
42934294
} else {
4294-
importedType = Impl.importMethodType(
4295+
importedType = Impl.importMethodParamsAndReturnType(
42954296
dc, decl, decl->parameters(), decl->isVariadic(),
42964297
isInSystemModule(dc), &bodyParams, importedName,
42974298
errorConvention, kind);
@@ -6252,7 +6253,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor(
62526253
// Import the type that this method will have.
62536254
Optional<ForeignErrorConvention> errorConvention;
62546255
ParameterList *bodyParams;
6255-
auto importedType = Impl.importMethodType(
6256+
auto importedType = Impl.importMethodParamsAndReturnType(
62566257
dc, objcMethod, args, variadic, isInSystemModule(dc), &bodyParams,
62576258
importedName, errorConvention, SpecialMethodKind::Constructor);
62586259
if (!importedType)

lib/ClangImporter/ImportType.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ ImportedType ClangImporter::Implementation::importFunctionReturnType(
15791579
OptionalityOfReturn);
15801580
}
15811581

1582-
ImportedType ClangImporter::Implementation::importFunctionType(
1582+
ImportedType ClangImporter::Implementation::importFunctionParamsAndReturnType(
15831583
DeclContext *dc, const clang::FunctionDecl *clangDecl,
15841584
ArrayRef<const clang::ParmVarDecl *> params, bool isVariadic,
15851585
bool isFromSystemModule, DeclName name, ParameterList *&parameterList) {
@@ -1871,7 +1871,7 @@ static Type mapGenericArgs(const DeclContext *fromDC,
18711871
return type.subst(subs);
18721872
}
18731873

1874-
ImportedType ClangImporter::Implementation::importMethodType(
1874+
ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
18751875
const DeclContext *dc, const clang::ObjCMethodDecl *clangDecl,
18761876
ArrayRef<const clang::ParmVarDecl *> params, bool isVariadic,
18771877
bool isFromSystemModule, ParameterList **bodyParams,
@@ -2165,7 +2165,7 @@ ImportedType ClangImporter::Implementation::importMethodType(
21652165
importedType.isImplicitlyUnwrapped()};
21662166
}
21672167

2168-
ImportedType ClangImporter::Implementation::importAccessorMethodType(
2168+
ImportedType ClangImporter::Implementation::importAccessorParamsAndReturnType(
21692169
const DeclContext *dc, const clang::ObjCPropertyDecl *property,
21702170
const clang::ObjCMethodDecl *clangDecl, bool isFromSystemModule,
21712171
ImportedName functionName, swift::ParameterList **params) {
@@ -2184,7 +2184,7 @@ ImportedType ClangImporter::Implementation::importAccessorMethodType(
21842184

21852185
// The member was defined in 'origDC', but is being imported into 'dc'.
21862186
// 'dc' must be a subclass or a type conforming to protocol.
2187-
// FIXME: Duplicated from importMethodType.
2187+
// FIXME: Duplicated from importMethodParamsAndReturnType.
21882188
DeclContext *origDC = importDeclContextOf(property,
21892189
property->getDeclContext());
21902190
assert(origDC);

lib/ClangImporter/ImporterImpl.h

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,11 +1038,13 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
10381038
/// to system APIs.
10391039
/// \param name The name of the function.
10401040
/// \param[out] parameterList The parameters visible inside the function body.
1041-
ImportedType importFunctionType(DeclContext *dc,
1042-
const clang::FunctionDecl *clangDecl,
1043-
ArrayRef<const clang::ParmVarDecl *> params,
1044-
bool isVariadic, bool isFromSystemModule,
1045-
DeclName name, ParameterList *&parameterList);
1041+
ImportedType
1042+
importFunctionParamsAndReturnType(DeclContext *dc,
1043+
const clang::FunctionDecl *clangDecl,
1044+
ArrayRef<const clang::ParmVarDecl *> params,
1045+
bool isVariadic, bool isFromSystemModule,
1046+
DeclName name,
1047+
ParameterList *&parameterList);
10461048

10471049
/// Import the given function return type.
10481050
///
@@ -1093,7 +1095,7 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
10931095
/// the return type of this method.
10941096
///
10951097
/// Note that this is not appropriate to use for property accessor methods.
1096-
/// Use #importAccessorMethodType instead.
1098+
/// Use #importAccessorParamsAndReturnType instead.
10971099
///
10981100
/// \param dc The context the method is being imported into.
10991101
/// \param clangDecl The underlying declaration.
@@ -1104,20 +1106,22 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
11041106
/// to system APIs.
11051107
/// \param[out] bodyParams The patterns visible inside the function body.
11061108
/// \param importedName How to import the name of the method.
1107-
/// \param[out] errorConvention Whether and how the method throws NSErrors.
1109+
/// \param[out] errorConv Whether and how the method throws NSErrors.
11081110
/// \param kind Controls whether we're building a type for a method that
11091111
/// needs special handling.
11101112
///
11111113
/// \returns the imported result type, or null if the type cannot be
11121114
/// imported.
11131115
ImportedType
1114-
importMethodType(const DeclContext *dc,
1115-
const clang::ObjCMethodDecl *clangDecl,
1116-
ArrayRef<const clang::ParmVarDecl *> params, bool isVariadic,
1117-
bool isFromSystemModule, ParameterList **bodyParams,
1118-
importer::ImportedName importedName,
1119-
Optional<ForeignErrorConvention> &errorConvention,
1120-
SpecialMethodKind kind);
1116+
importMethodParamsAndReturnType(const DeclContext *dc,
1117+
const clang::ObjCMethodDecl *clangDecl,
1118+
ArrayRef<const clang::ParmVarDecl *> params,
1119+
bool isVariadic,
1120+
bool isFromSystemModule,
1121+
ParameterList **bodyParams,
1122+
importer::ImportedName importedName,
1123+
Optional<ForeignErrorConvention> &errorConv,
1124+
SpecialMethodKind kind);
11211125

11221126
/// Import the type of an Objective-C method that will be imported as an
11231127
/// accessor for \p property.
@@ -1137,12 +1141,13 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
11371141
///
11381142
/// \returns the imported result type, or null if the type cannot be
11391143
/// imported.
1140-
ImportedType importAccessorMethodType(const DeclContext *dc,
1141-
const clang::ObjCPropertyDecl *property,
1142-
const clang::ObjCMethodDecl *clangDecl,
1143-
bool isFromSystemModule,
1144-
importer::ImportedName importedName,
1145-
ParameterList **params);
1144+
ImportedType
1145+
importAccessorParamsAndReturnType(const DeclContext *dc,
1146+
const clang::ObjCPropertyDecl *property,
1147+
const clang::ObjCMethodDecl *clangDecl,
1148+
bool isFromSystemModule,
1149+
importer::ImportedName importedName,
1150+
ParameterList **params);
11461151

11471152
/// Determine whether the given typedef-name is "special", meaning
11481153
/// that it has performed some non-trivial mapping of its underlying type

0 commit comments

Comments
 (0)