Skip to content

Commit 7e1d99c

Browse files
committed
[NFC] Rename some variable names for consistency
Use capitalization correctly in one variable name, and use the name used in other parts of the file for a parameter.
1 parent 47e4ab2 commit 7e1d99c

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,13 +2242,13 @@ getImportTypeKindForParam(const clang::ParmVarDecl *param) {
22422242
}
22432243

22442244
Optional<swift::Type> ClangImporter::Implementation::importParameterType(
2245-
const clang::ParmVarDecl *param, OptionalTypeKind OptionalityOfParam,
2245+
const clang::ParmVarDecl *param, OptionalTypeKind optionalityOfParam,
22462246
bool allowNSUIntegerAsInt, bool isNSDictionarySubscriptGetter,
22472247
bool paramIsError, bool paramIsCompletionHandler,
22482248
Optional<unsigned> completionHandlerErrorParamIndex,
22492249
ArrayRef<GenericTypeParamDecl *> genericParams,
2250-
llvm::function_ref<void(Diagnostic &&)> paramAddDiag, bool &isInOut,
2251-
bool &isParamTypeImplicitlyUnwrapped) {
2250+
llvm::function_ref<void(Diagnostic &&)> addImportDiagnosticFn,
2251+
bool &isInOut, bool &isParamTypeImplicitlyUnwrapped) {
22522252
auto paramTy = param->getType();
22532253

22542254
ImportTypeKind importKind = getImportTypeKindForParam(param);
@@ -2282,7 +2282,7 @@ Optional<swift::Type> ClangImporter::Implementation::importParameterType(
22822282
? PTK_UnsafePointer
22832283
: PTK_UnsafeMutablePointer;
22842284
auto genericType = findGenericTypeInGenericDecls(
2285-
*this, templateParamType, genericParams, attrs, paramAddDiag);
2285+
*this, templateParamType, genericParams, attrs, addImportDiagnosticFn);
22862286
swiftParamTy = genericType->wrapInPointer(pointerKind);
22872287
if (!swiftParamTy)
22882288
return None;
@@ -2291,13 +2291,13 @@ Optional<swift::Type> ClangImporter::Implementation::importParameterType(
22912291
auto templateParamType =
22922292
cast<clang::TemplateTypeParmType>(paramTy->getPointeeType());
22932293
swiftParamTy = findGenericTypeInGenericDecls(
2294-
*this, templateParamType, genericParams, attrs, paramAddDiag);
2294+
*this, templateParamType, genericParams, attrs, addImportDiagnosticFn);
22952295
if (!paramTy->getPointeeType().isConstQualified())
22962296
isInOut = true;
22972297
} else if (auto *templateParamType =
22982298
dyn_cast<clang::TemplateTypeParmType>(paramTy)) {
22992299
swiftParamTy = findGenericTypeInGenericDecls(
2300-
*this, templateParamType, genericParams, attrs, paramAddDiag);
2300+
*this, templateParamType, genericParams, attrs, addImportDiagnosticFn);
23012301
} else if (auto refType = dyn_cast<clang::ReferenceType>(paramTy)) {
23022302
// We don't support reference type to a dependent type, just bail.
23032303
if (refType->getPointeeType()->isDependentType()) {
@@ -2317,11 +2317,11 @@ Optional<swift::Type> ClangImporter::Implementation::importParameterType(
23172317
return None;
23182318

23192319
swiftParamTy = ExistentialType::get(nsCopying);
2320-
if (OptionalityOfParam != OTK_None)
2320+
if (optionalityOfParam != OTK_None)
23212321
swiftParamTy = OptionalType::get(swiftParamTy);
23222322

23232323
isParamTypeImplicitlyUnwrapped =
2324-
OptionalityOfParam == OTK_ImplicitlyUnwrappedOptional;
2324+
optionalityOfParam == OTK_ImplicitlyUnwrappedOptional;
23252325
}
23262326

23272327
if (!swiftParamTy) {
@@ -2339,11 +2339,11 @@ Optional<swift::Type> ClangImporter::Implementation::importParameterType(
23392339
// for the specific case when the throws conversion works, but is not
23402340
// sufficient if it fails. (The correct, overarching fix is ClangImporter
23412341
// being lazier.)
2342-
auto importedType =
2343-
importType(paramTy, importKind, paramAddDiag, allowNSUIntegerAsInt,
2344-
Bridgeability::Full, attrs, OptionalityOfParam,
2345-
/*resugarNSErrorPointer=*/!paramIsError,
2346-
completionHandlerErrorParamIndex);
2342+
auto importedType = importType(paramTy, importKind, addImportDiagnosticFn,
2343+
allowNSUIntegerAsInt, Bridgeability::Full,
2344+
attrs, optionalityOfParam,
2345+
/*resugarNSErrorPointer=*/!paramIsError,
2346+
completionHandlerErrorParamIndex);
23472347
if (!importedType)
23482348
return None;
23492349

@@ -2404,15 +2404,16 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
24042404
knownNonNull |= clangDecl->isFunctionTemplateSpecialization();
24052405

24062406
// Check nullability of the parameter.
2407-
OptionalTypeKind OptionalityOfParam = getParamOptionality(param, knownNonNull);
2407+
OptionalTypeKind optionalityOfParam =
2408+
getParamOptionality(param, knownNonNull);
24082409

24092410
ImportDiagnosticAdder paramAddDiag(*this, clangDecl, param->getLocation());
24102411

24112412
bool isInOut = false;
24122413
bool isParamTypeImplicitlyUnwrapped = false;
24132414

24142415
auto swiftParamTyOpt = importParameterType(
2415-
param, OptionalityOfParam, allowNSUIntegerAsInt,
2416+
param, optionalityOfParam, allowNSUIntegerAsInt,
24162417
/*isNSDictionarySubscriptGetter=*/false,
24172418
/*paramIsError=*/false,
24182419
/*paramIsCompletionHandler=*/false,

0 commit comments

Comments
 (0)