Skip to content

Commit 659d4d5

Browse files
author
Omar Habra
committed
Removing extras
1 parent ed168d9 commit 659d4d5

File tree

1 file changed

+31
-52
lines changed

1 file changed

+31
-52
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ static AccessorDecl *makeStructRawValueGetter(
696696
assert(storedVar->hasStorage());
697697

698698
ASTContext &C = Impl.SwiftContext;
699-
699+
700700
auto *params = ParameterList::createEmpty(C);
701701

702702
auto computedType = computedVar->getInterfaceType();
@@ -730,7 +730,7 @@ static AccessorDecl *makeFieldGetterDecl(ClangImporter::Implementation &Impl,
730730
auto &C = Impl.SwiftContext;
731731

732732
auto *params = ParameterList::createEmpty(C);
733-
733+
734734
auto getterType = importedFieldDecl->getInterfaceType();
735735
auto getterDecl = AccessorDecl::create(C,
736736
/*FuncLoc=*/importedFieldDecl->getLoc(),
@@ -1156,7 +1156,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
11561156
cSetterParamTypes,
11571157
clang::FunctionProtoType::ExtProtoInfo());
11581158
auto cSetterTypeInfo = Ctx.getTrivialTypeSourceInfo(cSetterType);
1159-
1159+
11601160
auto cSetterDecl = clang::FunctionDecl::Create(Ctx,
11611161
structDecl->getDeclContext(),
11621162
clang::SourceLocation(),
@@ -1188,7 +1188,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
11881188
clang::SC_None,
11891189
nullptr);
11901190
cGetterDecl->setParams(cGetterSelf);
1191-
1191+
11921192
auto cGetterSelfExpr = new (Ctx) clang::DeclRefExpr(Ctx, cGetterSelf, false,
11931193
recordType,
11941194
clang::VK_PRValue,
@@ -1201,7 +1201,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
12011201
clang::VK_PRValue,
12021202
clang::OK_BitField);
12031203

1204-
1204+
12051205
auto cGetterBody = clang::ReturnStmt::Create(Ctx, clang::SourceLocation(),
12061206
cGetterExpr,
12071207
nullptr);
@@ -1232,20 +1232,20 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
12321232
nullptr);
12331233
cSetterParams.push_back(cSetterSelf);
12341234
cSetterDecl->setParams(cSetterParams);
1235-
1235+
12361236
auto cSetterSelfExpr = new (Ctx) clang::DeclRefExpr(Ctx, cSetterSelf, false,
12371237
recordPointerType,
12381238
clang::VK_PRValue,
12391239
clang::SourceLocation());
1240-
1240+
12411241
auto cSetterMemberExpr = clang::MemberExpr::CreateImplicit(Ctx,
12421242
cSetterSelfExpr,
12431243
/*isarrow=*/true,
12441244
fieldDecl,
12451245
fieldType,
12461246
clang::VK_LValue,
12471247
clang::OK_BitField);
1248-
1248+
12491249
auto cSetterValueExpr = new (Ctx) clang::DeclRefExpr(Ctx, cSetterValue, false,
12501250
fieldType,
12511251
clang::VK_PRValue,
@@ -1260,7 +1260,7 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl,
12601260
clang::OK_Ordinary,
12611261
clang::SourceLocation(),
12621262
clang::FPOptionsOverride());
1263-
1263+
12641264
cSetterDecl->setBody(cSetterExpr);
12651265
}
12661266

@@ -2423,7 +2423,7 @@ namespace {
24232423
if (auto *typedefForAnon = decl->getTypedefNameForAnonDecl())
24242424
return importFullName(typedefForAnon);
24252425
}
2426-
2426+
24272427
return {ImportedName(), None};
24282428
}
24292429

@@ -2810,7 +2810,7 @@ namespace {
28102810
});
28112811

28122812
Result->setUnderlyingType(SwiftType);
2813-
2813+
28142814
// Make Objective-C's 'id' unavailable.
28152815
if (Impl.SwiftContext.LangOpts.EnableObjCInterop && isObjCId(Decl)) {
28162816
auto attr = AvailableAttr::createPlatformAgnostic(
@@ -2886,7 +2886,7 @@ namespace {
28862886
Impl.importDeclContextOf(decl, importedName.getEffectiveContext());
28872887
if (!dc)
28882888
return nullptr;
2889-
2889+
28902890
auto name = importedName.getDeclName().getBaseIdentifier();
28912891

28922892
// Create the enum declaration and record it.
@@ -2952,7 +2952,7 @@ namespace {
29522952
ProtocolDecl *bridgedNSError = nullptr;
29532953
ClassDecl *nsErrorDecl = nullptr;
29542954
ProtocolDecl *errorCodeProto = nullptr;
2955-
if (enumInfo.isErrorEnum() &&
2955+
if (enumInfo.isErrorEnum() &&
29562956
(bridgedNSError =
29572957
C.getProtocol(KnownProtocolKind::BridgedStoredNSError)) &&
29582958
(nsErrorDecl = C.getNSErrorDecl()) &&
@@ -3128,7 +3128,7 @@ namespace {
31283128
Impl.ImportedDecls[{canonicalClangDecl, getVersion()}] = result;
31293129

31303130
// Import each of the enumerators.
3131-
3131+
31323132
bool addEnumeratorsAsMembers;
31333133
switch (enumKind) {
31343134
case EnumKind::Constants:
@@ -3286,7 +3286,7 @@ namespace {
32863286
addDecl(result, enumeratorDecl);
32873287
for (auto *variant : variantDecls)
32883288
addDecl(result, variant);
3289-
3289+
32903290
// If there is an error wrapper, add an alias within the
32913291
// wrapper to the corresponding value within the enumerator
32923292
// context.
@@ -3338,7 +3338,7 @@ namespace {
33383338
// Track whether this record contains fields we can't reference in Swift
33393339
// as stored properties.
33403340
bool hasUnreferenceableStorage = false;
3341-
3341+
33423342
// Track whether this record contains fields that can't be zero-
33433343
// initialized.
33443344
bool hasZeroInitializableStorage = true;
@@ -3529,7 +3529,7 @@ namespace {
35293529
methods.push_back(MD);
35303530
continue;
35313531
}
3532-
3532+
35333533
if (isa<VarDecl>(member) && isa<clang::CXXMethodDecl>(nd)) {
35343534
result->addMember(member);
35353535
continue;
@@ -3575,7 +3575,7 @@ namespace {
35753575
/*wantBody=*/true);
35763576
ctors.push_back(valueCtor);
35773577
}
3578-
3578+
35793579
// TODO: we have a problem lazily looking up members of an unnamed
35803580
// record, so we add them here. To fix this `translateContext` needs to
35813581
// somehow translate unnamed contexts so that `SwiftLookupTable::lookup`
@@ -4230,10 +4230,10 @@ namespace {
42304230
DeclName ctorName(Impl.SwiftContext, DeclBaseName::createConstructor(),
42314231
bodyParams);
42324232
result = Impl.createDeclWithClangNode<ConstructorDecl>(
4233-
clangNode, AccessLevel::Public, ctorName, loc,
4233+
clangNode, AccessLevel::Public, ctorName, loc,
42344234
/*failable=*/false, /*FailabilityLoc=*/SourceLoc(),
42354235
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
4236-
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
4236+
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
42374237
bodyParams, genericParams, dc);
42384238
} else {
42394239
auto resultTy = importedType.getType();
@@ -4345,7 +4345,7 @@ namespace {
43454345

43464346
AccessorDecl *tryCreateGetterAccessor(const clang::CXXMethodDecl *clangMeth,
43474347
VarDecl *swiftVar, FuncDecl *method) {
4348-
4348+
43494349
// If we have a constexpr var with an evaluated value, try to create an
43504350
// accessor for it. If we can remove all references to the global (which
43514351
// we should be able to do for constexprs) then we can remove the global
@@ -4777,33 +4777,33 @@ namespace {
47774777
// Only import types for now.
47784778
if (!isa<clang::TypeDecl>(decl->getUnderlyingDecl()))
47794779
return nullptr;
4780-
4780+
47814781
ImportedName importedName;
47824782
Optional<ImportedName> correctSwiftName;
47834783
std::tie(importedName, correctSwiftName) = importFullName(decl);
47844784
auto Name = importedName.getDeclName().getBaseIdentifier();
47854785
if (Name.empty())
47864786
return nullptr;
4787-
4787+
47884788
// If we've been asked to produce a compatibility stub, handle it via a
47894789
// typealias.
47904790
if (correctSwiftName)
47914791
return importCompatibilityTypeAlias(decl, importedName,
47924792
*correctSwiftName);
4793-
4793+
47944794
auto DC =
47954795
Impl.importDeclContextOf(decl, importedName.getEffectiveContext());
47964796
if (!DC)
47974797
return nullptr;
4798-
4798+
47994799
Decl *SwiftDecl = Impl.importDecl(decl->getUnderlyingDecl(), getActiveSwiftVersion());
48004800
if (!SwiftDecl)
48014801
return nullptr;
48024802

48034803
const TypeDecl *SwiftTypeDecl = dyn_cast<TypeDecl>(SwiftDecl);
48044804
if (!SwiftTypeDecl)
48054805
return nullptr;
4806-
4806+
48074807
auto Loc = Impl.importSourceLoc(decl->getLocation());
48084808
auto Result = Impl.createDeclWithClangNode<TypeAliasDecl>(
48094809
decl,
@@ -5471,7 +5471,7 @@ namespace {
54715471
objcClass->getDeclaredType());
54725472
Impl.SwiftContext.evaluator.cacheOutput(ExtendedNominalRequest{result},
54735473
std::move(objcClass));
5474-
5474+
54755475
// Determine the type and generic args of the extension.
54765476
if (objcClass->getGenericParams()) {
54775477
result->setGenericSignature(objcClass->getGenericSignature());
@@ -5490,7 +5490,7 @@ namespace {
54905490
}
54915491

54925492
template <typename T, typename U>
5493-
T *resolveSwiftDeclImpl(const U *decl, Identifier name,
5493+
T *resolveSwiftDeclImpl(const U *decl, Identifier name,
54945494
bool hasKnownSwiftName, ModuleDecl *overlay) {
54955495
const auto &languageVersion =
54965496
Impl.SwiftContext.LangOpts.EffectiveLanguageVersion;
@@ -6363,7 +6363,7 @@ Decl *SwiftDeclConverter::importCompatibilityTypeAlias(
63636363
}
63646364

63656365
alias->setUnderlyingType(typeDecl->getDeclaredInterfaceType());
6366-
6366+
63676367
// Record that this is the official version of this declaration.
63686368
Impl.ImportedDecls[{decl->getCanonicalDecl(), getVersion()}] = alias;
63696369
markAsVariant(alias, correctSwiftName);
@@ -7993,27 +7993,6 @@ VarDecl *SwiftDeclConverter::makeProperty(Identifier identifier, FuncDecl *gette
79937993

79947994

79957995
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);
80177996
}
80187997

80197998
SubscriptDecl *
@@ -9288,7 +9267,7 @@ ClangImporter::Implementation::importDeclImpl(const clang::NamedDecl *ClangDecl,
92889267
const_cast<clang::NamedDecl *>(ClangDecl)->addAttr(
92899268
clang::SwiftAttrAttr::CreateImplicit(ClangDecl->getASTContext(), "import_as_setter"));
92909269
}
9291-
9270+
92929271
}
92939272

92949273
if (!Result) {
@@ -9598,7 +9577,7 @@ ClangImporter::Implementation::importMirroredDecl(const clang::NamedDecl *decl,
95989577

95999578
auto updateMirroredDecl = [&](Decl *result) {
96009579
result->setImplicit();
9601-
9580+
96029581
// Map the Clang attributes onto Swift attributes.
96039582
importAttributes(decl, result);
96049583

0 commit comments

Comments
 (0)