Skip to content

Commit 6657882

Browse files
committed
AST: Inline ConformanceLookupTable::addInheritedProtocols()
1 parent 66801fd commit 6657882

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

lib/AST/ConformanceLookupTable.cpp

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,19 @@ void ConformanceLookupTable::updateLookupTable(NominalTypeDecl *nominal,
295295
forEachInStage(
296296
stage, nominal,
297297
[&](NominalTypeDecl *nominal) {
298-
addInheritedProtocols(nominal,
299-
ConformanceSource::forExplicit(nominal));
298+
auto source = ConformanceSource::forExplicit(nominal);
299+
300+
// Get all of the protocols in the inheritance clause.
301+
InvertibleProtocolSet inverses;
302+
bool anyObject = false;
303+
for (const auto &found :
304+
getDirectlyInheritedNominalTypeDecls(nominal, inverses, anyObject)) {
305+
if (auto proto = dyn_cast<ProtocolDecl>(found.Item)) {
306+
addProtocol(proto, found.Loc,
307+
source.withUncheckedLoc(found.uncheckedLoc)
308+
.withPreconcurrencyLoc(found.preconcurrencyLoc));
309+
}
310+
}
300311

301312
addMacroGeneratedProtocols(
302313
nominal, ConformanceSource::forUnexpandedMacro(nominal));
@@ -494,22 +505,6 @@ bool ConformanceLookupTable::addProtocol(ProtocolDecl *protocol, SourceLoc loc,
494505
return true;
495506
}
496507

497-
void ConformanceLookupTable::addInheritedProtocols(
498-
llvm::PointerUnion<const TypeDecl *, const ExtensionDecl *> decl,
499-
ConformanceSource source) {
500-
// Find all of the protocols in the inheritance list.
501-
InvertibleProtocolSet inverses;
502-
bool anyObject = false;
503-
for (const auto &found :
504-
getDirectlyInheritedNominalTypeDecls(decl, inverses, anyObject)) {
505-
if (auto proto = dyn_cast<ProtocolDecl>(found.Item)) {
506-
addProtocol(proto, found.Loc,
507-
source.withUncheckedLoc(found.uncheckedLoc)
508-
.withPreconcurrencyLoc(found.preconcurrencyLoc));
509-
}
510-
}
511-
}
512-
513508
void ConformanceLookupTable::addMacroGeneratedProtocols(
514509
NominalTypeDecl *nominal, ConformanceSource source) {
515510
nominal->forEachAttachedMacro(

lib/AST/ConformanceLookupTable.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,6 @@ class ConformanceLookupTable : public ASTAllocated<ConformanceLookupTable> {
381381
bool addProtocol(ProtocolDecl *protocol, SourceLoc loc,
382382
ConformanceSource source);
383383

384-
/// Add the protocols from the given list.
385-
void addInheritedProtocols(
386-
llvm::PointerUnion<const TypeDecl *, const ExtensionDecl *> decl,
387-
ConformanceSource source);
388-
389384
/// Add the protocols added by attached extension macros that are not
390385
/// yet expanded.
391386
void addMacroGeneratedProtocols(

0 commit comments

Comments
 (0)