@@ -696,7 +696,7 @@ static AccessorDecl *makeStructRawValueGetter(
696
696
assert (storedVar->hasStorage ());
697
697
698
698
ASTContext &C = Impl.SwiftContext ;
699
-
699
+
700
700
auto *params = ParameterList::createEmpty (C);
701
701
702
702
auto computedType = computedVar->getInterfaceType ();
@@ -730,7 +730,7 @@ static AccessorDecl *makeFieldGetterDecl(ClangImporter::Implementation &Impl,
730
730
auto &C = Impl.SwiftContext ;
731
731
732
732
auto *params = ParameterList::createEmpty (C);
733
-
733
+
734
734
auto getterType = importedFieldDecl->getInterfaceType ();
735
735
auto getterDecl = AccessorDecl::create (C,
736
736
/* FuncLoc=*/ importedFieldDecl->getLoc (),
@@ -1156,7 +1156,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
1156
1156
cSetterParamTypes,
1157
1157
clang::FunctionProtoType::ExtProtoInfo ());
1158
1158
auto cSetterTypeInfo = Ctx.getTrivialTypeSourceInfo (cSetterType);
1159
-
1159
+
1160
1160
auto cSetterDecl = clang::FunctionDecl::Create (Ctx,
1161
1161
structDecl->getDeclContext (),
1162
1162
clang::SourceLocation (),
@@ -1188,7 +1188,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
1188
1188
clang::SC_None,
1189
1189
nullptr );
1190
1190
cGetterDecl->setParams (cGetterSelf);
1191
-
1191
+
1192
1192
auto cGetterSelfExpr = new (Ctx) clang::DeclRefExpr (Ctx, cGetterSelf, false ,
1193
1193
recordType,
1194
1194
clang::VK_PRValue,
@@ -1201,7 +1201,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
1201
1201
clang::VK_PRValue,
1202
1202
clang::OK_BitField);
1203
1203
1204
-
1204
+
1205
1205
auto cGetterBody = clang::ReturnStmt::Create (Ctx, clang::SourceLocation (),
1206
1206
cGetterExpr,
1207
1207
nullptr );
@@ -1232,20 +1232,20 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
1232
1232
nullptr );
1233
1233
cSetterParams.push_back (cSetterSelf);
1234
1234
cSetterDecl->setParams (cSetterParams);
1235
-
1235
+
1236
1236
auto cSetterSelfExpr = new (Ctx) clang::DeclRefExpr (Ctx, cSetterSelf, false ,
1237
1237
recordPointerType,
1238
1238
clang::VK_PRValue,
1239
1239
clang::SourceLocation ());
1240
-
1240
+
1241
1241
auto cSetterMemberExpr = clang::MemberExpr::CreateImplicit (Ctx,
1242
1242
cSetterSelfExpr,
1243
1243
/* isarrow=*/ true ,
1244
1244
fieldDecl,
1245
1245
fieldType,
1246
1246
clang::VK_LValue,
1247
1247
clang::OK_BitField);
1248
-
1248
+
1249
1249
auto cSetterValueExpr = new (Ctx) clang::DeclRefExpr (Ctx, cSetterValue, false ,
1250
1250
fieldType,
1251
1251
clang::VK_PRValue,
@@ -1260,7 +1260,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
1260
1260
clang::OK_Ordinary,
1261
1261
clang::SourceLocation (),
1262
1262
clang::FPOptionsOverride ());
1263
-
1263
+
1264
1264
cSetterDecl->setBody (cSetterExpr);
1265
1265
}
1266
1266
@@ -2423,7 +2423,7 @@ namespace {
2423
2423
if (auto *typedefForAnon = decl->getTypedefNameForAnonDecl ())
2424
2424
return importFullName (typedefForAnon);
2425
2425
}
2426
-
2426
+
2427
2427
return {ImportedName (), None};
2428
2428
}
2429
2429
@@ -2810,7 +2810,7 @@ namespace {
2810
2810
});
2811
2811
2812
2812
Result->setUnderlyingType (SwiftType);
2813
-
2813
+
2814
2814
// Make Objective-C's 'id' unavailable.
2815
2815
if (Impl.SwiftContext .LangOpts .EnableObjCInterop && isObjCId (Decl)) {
2816
2816
auto attr = AvailableAttr::createPlatformAgnostic (
@@ -2886,7 +2886,7 @@ namespace {
2886
2886
Impl.importDeclContextOf (decl, importedName.getEffectiveContext ());
2887
2887
if (!dc)
2888
2888
return nullptr ;
2889
-
2889
+
2890
2890
auto name = importedName.getDeclName ().getBaseIdentifier ();
2891
2891
2892
2892
// Create the enum declaration and record it.
@@ -2952,7 +2952,7 @@ namespace {
2952
2952
ProtocolDecl *bridgedNSError = nullptr ;
2953
2953
ClassDecl *nsErrorDecl = nullptr ;
2954
2954
ProtocolDecl *errorCodeProto = nullptr ;
2955
- if (enumInfo.isErrorEnum () &&
2955
+ if (enumInfo.isErrorEnum () &&
2956
2956
(bridgedNSError =
2957
2957
C.getProtocol (KnownProtocolKind::BridgedStoredNSError)) &&
2958
2958
(nsErrorDecl = C.getNSErrorDecl ()) &&
@@ -3128,7 +3128,7 @@ namespace {
3128
3128
Impl.ImportedDecls [{canonicalClangDecl, getVersion ()}] = result;
3129
3129
3130
3130
// Import each of the enumerators.
3131
-
3131
+
3132
3132
bool addEnumeratorsAsMembers;
3133
3133
switch (enumKind) {
3134
3134
case EnumKind::Constants:
@@ -3286,7 +3286,7 @@ namespace {
3286
3286
addDecl (result, enumeratorDecl);
3287
3287
for (auto *variant : variantDecls)
3288
3288
addDecl (result, variant);
3289
-
3289
+
3290
3290
// If there is an error wrapper, add an alias within the
3291
3291
// wrapper to the corresponding value within the enumerator
3292
3292
// context.
@@ -3338,7 +3338,7 @@ namespace {
3338
3338
// Track whether this record contains fields we can't reference in Swift
3339
3339
// as stored properties.
3340
3340
bool hasUnreferenceableStorage = false ;
3341
-
3341
+
3342
3342
// Track whether this record contains fields that can't be zero-
3343
3343
// initialized.
3344
3344
bool hasZeroInitializableStorage = true ;
@@ -3529,7 +3529,7 @@ namespace {
3529
3529
methods.push_back (MD);
3530
3530
continue ;
3531
3531
}
3532
-
3532
+
3533
3533
if (isa<VarDecl>(member) && isa<clang::CXXMethodDecl>(nd)) {
3534
3534
result->addMember (member);
3535
3535
continue ;
@@ -3575,7 +3575,7 @@ namespace {
3575
3575
/* wantBody=*/ true );
3576
3576
ctors.push_back (valueCtor);
3577
3577
}
3578
-
3578
+
3579
3579
// TODO: we have a problem lazily looking up members of an unnamed
3580
3580
// record, so we add them here. To fix this `translateContext` needs to
3581
3581
// somehow translate unnamed contexts so that `SwiftLookupTable::lookup`
@@ -4230,10 +4230,10 @@ namespace {
4230
4230
DeclName ctorName (Impl.SwiftContext , DeclBaseName::createConstructor (),
4231
4231
bodyParams);
4232
4232
result = Impl.createDeclWithClangNode <ConstructorDecl>(
4233
- clangNode, AccessLevel::Public, ctorName, loc,
4233
+ clangNode, AccessLevel::Public, ctorName, loc,
4234
4234
/* failable=*/ false , /* FailabilityLoc=*/ SourceLoc (),
4235
4235
/* Async=*/ false , /* AsyncLoc=*/ SourceLoc (),
4236
- /* Throws=*/ false , /* ThrowsLoc=*/ SourceLoc (),
4236
+ /* Throws=*/ false , /* ThrowsLoc=*/ SourceLoc (),
4237
4237
bodyParams, genericParams, dc);
4238
4238
} else {
4239
4239
auto resultTy = importedType.getType ();
@@ -4345,7 +4345,7 @@ namespace {
4345
4345
4346
4346
AccessorDecl *tryCreateGetterAccessor (const clang::CXXMethodDecl *clangMeth,
4347
4347
VarDecl *swiftVar, FuncDecl *method) {
4348
-
4348
+
4349
4349
// If we have a constexpr var with an evaluated value, try to create an
4350
4350
// accessor for it. If we can remove all references to the global (which
4351
4351
// we should be able to do for constexprs) then we can remove the global
@@ -4777,33 +4777,33 @@ namespace {
4777
4777
// Only import types for now.
4778
4778
if (!isa<clang::TypeDecl>(decl->getUnderlyingDecl ()))
4779
4779
return nullptr ;
4780
-
4780
+
4781
4781
ImportedName importedName;
4782
4782
Optional<ImportedName> correctSwiftName;
4783
4783
std::tie (importedName, correctSwiftName) = importFullName (decl);
4784
4784
auto Name = importedName.getDeclName ().getBaseIdentifier ();
4785
4785
if (Name.empty ())
4786
4786
return nullptr ;
4787
-
4787
+
4788
4788
// If we've been asked to produce a compatibility stub, handle it via a
4789
4789
// typealias.
4790
4790
if (correctSwiftName)
4791
4791
return importCompatibilityTypeAlias (decl, importedName,
4792
4792
*correctSwiftName);
4793
-
4793
+
4794
4794
auto DC =
4795
4795
Impl.importDeclContextOf (decl, importedName.getEffectiveContext ());
4796
4796
if (!DC)
4797
4797
return nullptr ;
4798
-
4798
+
4799
4799
Decl *SwiftDecl = Impl.importDecl (decl->getUnderlyingDecl (), getActiveSwiftVersion ());
4800
4800
if (!SwiftDecl)
4801
4801
return nullptr ;
4802
4802
4803
4803
const TypeDecl *SwiftTypeDecl = dyn_cast<TypeDecl>(SwiftDecl);
4804
4804
if (!SwiftTypeDecl)
4805
4805
return nullptr ;
4806
-
4806
+
4807
4807
auto Loc = Impl.importSourceLoc (decl->getLocation ());
4808
4808
auto Result = Impl.createDeclWithClangNode <TypeAliasDecl>(
4809
4809
decl,
@@ -5471,7 +5471,7 @@ namespace {
5471
5471
objcClass->getDeclaredType ());
5472
5472
Impl.SwiftContext .evaluator .cacheOutput (ExtendedNominalRequest{result},
5473
5473
std::move (objcClass));
5474
-
5474
+
5475
5475
// Determine the type and generic args of the extension.
5476
5476
if (objcClass->getGenericParams ()) {
5477
5477
result->setGenericSignature (objcClass->getGenericSignature ());
@@ -5490,7 +5490,7 @@ namespace {
5490
5490
}
5491
5491
5492
5492
template <typename T, typename U>
5493
- T *resolveSwiftDeclImpl (const U *decl, Identifier name,
5493
+ T *resolveSwiftDeclImpl (const U *decl, Identifier name,
5494
5494
bool hasKnownSwiftName, ModuleDecl *overlay) {
5495
5495
const auto &languageVersion =
5496
5496
Impl.SwiftContext .LangOpts .EffectiveLanguageVersion ;
@@ -6363,7 +6363,7 @@ Decl *SwiftDeclConverter::importCompatibilityTypeAlias(
6363
6363
}
6364
6364
6365
6365
alias->setUnderlyingType (typeDecl->getDeclaredInterfaceType ());
6366
-
6366
+
6367
6367
// Record that this is the official version of this declaration.
6368
6368
Impl.ImportedDecls [{decl->getCanonicalDecl (), getVersion ()}] = alias;
6369
6369
markAsVariant (alias, correctSwiftName);
@@ -7993,27 +7993,6 @@ VarDecl *SwiftDeclConverter::makeProperty(Identifier identifier, FuncDecl *gette
7993
7993
7994
7994
7995
7995
return result;
7996
- // VarDecl *getterResult = nullptr;
7997
- // if (It == Impl.GetterSetterMap.end()) {
7998
- // getterResult = Impl.createDeclWithClangNode<VarDecl>(
7999
- // decl, AccessLevel::Public,
8000
- // /*IsStatic*/ false, VarDecl::Introducer::Var, SourceLoc(), name, dc);
8001
- // } else {
8002
- // getterResult = get<0>(It->getSecond());
8003
- // }
8004
- // auto *getter = get<1>(It->getSecond());
8005
- // getterResult->setImplInfo(StorageImplInfo::getMutableComputed());
8006
- // getterResult->setAccessors(
8007
- // SourceLoc(),
8008
- // {getter,
8009
- // tryCreateSetterAccessor(decl, getterResult, cast<FuncDecl>(method))},
8010
- // SourceLoc());
8011
- // getterResult->dump();
8012
- // return method;
8013
- //
8014
- // getterResult->setInterfaceType(type);
8015
- // StorageImplInfo info(ReadImplKind::Get);
8016
- // getterResult->setLazyStorageProperty(false);
8017
7996
}
8018
7997
8019
7998
SubscriptDecl *
@@ -9288,7 +9267,7 @@ ClangImporter::Implementation::importDeclImpl(const clang::NamedDecl *ClangDecl,
9288
9267
const_cast <clang::NamedDecl *>(ClangDecl)->addAttr (
9289
9268
clang::SwiftAttrAttr::CreateImplicit (ClangDecl->getASTContext (), " import_as_setter" ));
9290
9269
}
9291
-
9270
+
9292
9271
}
9293
9272
9294
9273
if (!Result) {
@@ -9598,7 +9577,7 @@ ClangImporter::Implementation::importMirroredDecl(const clang::NamedDecl *decl,
9598
9577
9599
9578
auto updateMirroredDecl = [&](Decl *result) {
9600
9579
result->setImplicit ();
9601
-
9580
+
9602
9581
// Map the Clang attributes onto Swift attributes.
9603
9582
importAttributes (decl, result);
9604
9583
0 commit comments