Skip to content

Commit 43e984b

Browse files
authored
Merge pull request #1810 from swiftwasm/maxd/merge-master
Resolve conflicts with upstream branch renaming
2 parents 3c47194 + 7718149 commit 43e984b

File tree

10 files changed

+136
-311
lines changed

10 files changed

+136
-311
lines changed

include/swift/AST/ASTScope.h

+19-59
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ class ASTScopeImpl {
298298
bool verifyThatChildrenAreContainedWithin(SourceRange) const;
299299
bool verifyThatThisNodeComeAfterItsPriorSibling() const;
300300

301-
virtual SourceRange
302-
getSourceRangeOfEnclosedParamsOfASTNode(bool omitAssertions) const;
303-
304301
private:
305302
bool checkSourceRangeAfterExpansion(const ASTContext &) const;
306303

@@ -410,7 +407,7 @@ class ASTScopeImpl {
410407
using DeclConsumer = namelookup::AbstractASTScopeDeclConsumer &;
411408

412409
/// Entry point into ASTScopeImpl-land for lookups
413-
static llvm::SmallVector<const ASTScopeImpl *, 0>
410+
static void
414411
unqualifiedLookup(SourceFile *, DeclNameRef, SourceLoc, DeclConsumer);
415412

416413
/// Entry point into ASTScopeImpl-land for labeled statement lookups.
@@ -460,22 +457,17 @@ class ASTScopeImpl {
460457
/// duplicating work.
461458
///
462459
/// Look in this scope.
463-
/// \param history are the scopes traversed for this lookup (including this
464-
/// one) \param limit A scope into which lookup should not go. See \c
460+
/// \param limit A scope into which lookup should not go. See \c
465461
/// getLookupLimit. \param lastListSearched Last list searched.
466462
/// \param consumer is the object to which found decls are reported.
467-
void lookup(llvm::SmallVectorImpl<const ASTScopeImpl *> &history,
468-
NullablePtr<const ASTScopeImpl> limit,
463+
void lookup(NullablePtr<const ASTScopeImpl> limit,
469464
NullablePtr<const GenericParamList> lastListSearched,
470465
DeclConsumer consumer) const;
471466

472467
protected:
473468
/// Find either locals or members (no scope has both)
474-
/// \param history The scopes visited since the start of lookup (including
475-
/// this one)
476469
/// \return True if lookup is done
477-
virtual bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *> history,
478-
DeclConsumer consumer) const;
470+
virtual bool lookupLocalsOrMembers(DeclConsumer consumer) const;
479471

480472
/// Returns isDone and the list searched, if any
481473
std::pair<bool, NullablePtr<const GenericParamList>>
@@ -609,7 +601,6 @@ class Portion {
609601
bool omitAssertions) const = 0;
610602

611603
virtual bool lookupMembersOf(const GenericTypeOrExtensionScope *scope,
612-
ArrayRef<const ASTScopeImpl *>,
613604
ASTScopeImpl::DeclConsumer consumer) const;
614605

615606
virtual NullablePtr<const ASTScopeImpl>
@@ -671,7 +662,6 @@ class Portion {
671662
virtual ~GenericTypeOrExtensionWhereOrBodyPortion() {}
672663

673664
bool lookupMembersOf(const GenericTypeOrExtensionScope *scope,
674-
ArrayRef<const ASTScopeImpl *>,
675665
ASTScopeImpl::DeclConsumer consumer) const override;
676666
};
677667

@@ -684,7 +674,6 @@ class GenericTypeOrExtensionWherePortion final
684674
: GenericTypeOrExtensionWhereOrBodyPortion("Where") {}
685675

686676
bool lookupMembersOf(const GenericTypeOrExtensionScope *scope,
687-
ArrayRef<const ASTScopeImpl *>,
688677
ASTScopeImpl::DeclConsumer consumer) const override;
689678

690679
ASTScopeImpl *expandScope(GenericTypeOrExtensionScope *,
@@ -788,8 +777,7 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
788777

789778
protected:
790779
bool
791-
lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *> history,
792-
ASTScopeImpl::DeclConsumer consumer) const override;
780+
lookupLocalsOrMembers(ASTScopeImpl::DeclConsumer consumer) const override;
793781
void printSpecifics(llvm::raw_ostream &out) const override;
794782

795783
public:
@@ -955,8 +943,7 @@ class GenericParamScope final : public ASTScopeImpl {
955943
}
956944

957945
protected:
958-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
959-
DeclConsumer) const override;
946+
bool lookupLocalsOrMembers(DeclConsumer) const override;
960947
};
961948

962949
/// Concrete class for a function/initializer/deinitializer
@@ -991,13 +978,6 @@ class AbstractFunctionDeclScope final : public ASTScopeImpl {
991978

992979
NullablePtr<const void> getReferrent() const override;
993980

994-
protected:
995-
SourceRange
996-
getSourceRangeOfEnclosedParamsOfASTNode(bool omitAssertions) const override;
997-
998-
private:
999-
static SourceLoc getParmsSourceLocOfAFD(AbstractFunctionDecl *);
1000-
1001981
protected:
1002982
NullablePtr<const GenericParamList> genericParams() const override;
1003983
};
@@ -1068,8 +1048,7 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
10681048
NullablePtr<ASTScopeImpl> getParentOfASTAncestorScopesToBeRescued() override;
10691049

10701050
protected:
1071-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1072-
DeclConsumer) const override;
1051+
bool lookupLocalsOrMembers(DeclConsumer) const override;
10731052

10741053
public:
10751054
NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion() override;
@@ -1082,8 +1061,7 @@ class FunctionBodyScope final : public AbstractFunctionBodyScope {
10821061
FunctionBodyScope(AbstractFunctionDecl *e)
10831062
: AbstractFunctionBodyScope(e) {}
10841063
std::string getClassName() const override;
1085-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1086-
DeclConsumer consumer) const override;
1064+
bool lookupLocalsOrMembers(DeclConsumer consumer) const override;
10871065
};
10881066

10891067
class DefaultArgumentInitializerScope final : public ASTScopeImpl {
@@ -1221,8 +1199,7 @@ class PatternEntryDeclScope final : public AbstractPatternEntryScope {
12211199
NullablePtr<const void> getReferrent() const override;
12221200

12231201
protected:
1224-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1225-
DeclConsumer) const override;
1202+
bool lookupLocalsOrMembers(DeclConsumer) const override;
12261203
};
12271204

12281205
class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
@@ -1249,8 +1226,7 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
12491226
virtual NullablePtr<DeclContext> getDeclContext() const override;
12501227

12511228
protected:
1252-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1253-
DeclConsumer) const override;
1229+
bool lookupLocalsOrMembers(DeclConsumer) const override;
12541230
};
12551231

12561232
/// The scope introduced by a conditional clause in an if/guard/while
@@ -1312,8 +1288,7 @@ class ConditionalClausePatternUseScope final : public ASTScopeImpl {
13121288

13131289
protected:
13141290
ASTScopeImpl *expandSpecifically(ScopeCreator &) override;
1315-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1316-
DeclConsumer) const override;
1291+
bool lookupLocalsOrMembers(DeclConsumer) const override;
13171292
void printSpecifics(llvm::raw_ostream &out) const override;
13181293
bool isLabeledStmtLookupTerminator() const override;
13191294
};
@@ -1340,8 +1315,7 @@ class CaptureListScope final : public ASTScopeImpl {
13401315
NullablePtr<Expr> getExprIfAny() const override { return expr; }
13411316
Expr *getExpr() const { return expr; }
13421317
NullablePtr<const void> getReferrent() const override;
1343-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1344-
DeclConsumer) const override;
1318+
bool lookupLocalsOrMembers(DeclConsumer) const override;
13451319
};
13461320

13471321
/// For a closure with named parameters, this scope does the local bindings.
@@ -1374,8 +1348,7 @@ class ClosureParametersScope final : public ASTScopeImpl {
13741348
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
13751349

13761350
protected:
1377-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1378-
DeclConsumer) const override;
1351+
bool lookupLocalsOrMembers(DeclConsumer) const override;
13791352
};
13801353

13811354
class TopLevelCodeScope final : public ASTScopeImpl {
@@ -1439,8 +1412,7 @@ class SpecializeAttributeScope final : public ASTScopeImpl {
14391412

14401413
protected:
14411414
ASTScopeImpl *expandSpecifically(ScopeCreator &) override;
1442-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1443-
DeclConsumer) const override;
1415+
bool lookupLocalsOrMembers(DeclConsumer) const override;
14441416
};
14451417

14461418
/// A `@differentiable` attribute scope.
@@ -1473,8 +1445,7 @@ class DifferentiableAttributeScope final : public ASTScopeImpl {
14731445

14741446
protected:
14751447
ASTScopeImpl *expandSpecifically(ScopeCreator &) override;
1476-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1477-
DeclConsumer) const override;
1448+
bool lookupLocalsOrMembers(DeclConsumer) const override;
14781449
};
14791450

14801451
class SubscriptDeclScope final : public ASTScopeImpl {
@@ -1507,9 +1478,6 @@ class SubscriptDeclScope final : public ASTScopeImpl {
15071478
NullablePtr<const void> getReferrent() const override;
15081479

15091480
protected:
1510-
SourceRange
1511-
getSourceRangeOfEnclosedParamsOfASTNode(bool omitAssertions) const override;
1512-
15131481
NullablePtr<const GenericParamList> genericParams() const override;
15141482
NullablePtr<AbstractStorageDecl>
15151483
getEnclosingAbstractStorageDecl() const override {
@@ -1566,10 +1534,6 @@ class EnumElementScope : public ASTScopeImpl {
15661534
NullablePtr<Decl> getDeclIfAny() const override { return decl; }
15671535
Decl *getDecl() const { return decl; }
15681536

1569-
protected:
1570-
SourceRange
1571-
getSourceRangeOfEnclosedParamsOfASTNode(bool omitAssertions) const override;
1572-
15731537
private:
15741538
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
15751539
};
@@ -1780,8 +1744,7 @@ class ForEachPatternScope final : public ASTScopeImpl {
17801744
getSourceRangeOfThisASTNode(bool omitAssertions = false) const override;
17811745

17821746
protected:
1783-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1784-
DeclConsumer) const override;
1747+
bool lookupLocalsOrMembers(DeclConsumer) const override;
17851748
bool isLabeledStmtLookupTerminator() const override;
17861749
};
17871750

@@ -1859,8 +1822,7 @@ class CaseLabelItemScope final : public ASTScopeImpl {
18591822
getSourceRangeOfThisASTNode(bool omitAssertions = false) const override;
18601823

18611824
protected:
1862-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1863-
ASTScopeImpl::DeclConsumer) const override;
1825+
bool lookupLocalsOrMembers(ASTScopeImpl::DeclConsumer) const override;
18641826
};
18651827

18661828
/// The scope used for the body of a 'case' statement.
@@ -1888,8 +1850,7 @@ class CaseStmtBodyScope final : public ASTScopeImpl {
18881850
SourceRange
18891851
getSourceRangeOfThisASTNode(bool omitAssertions = false) const override;
18901852
protected:
1891-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1892-
ASTScopeImpl::DeclConsumer) const override;
1853+
bool lookupLocalsOrMembers(ASTScopeImpl::DeclConsumer) const override;
18931854
bool isLabeledStmtLookupTerminator() const override;
18941855
};
18951856

@@ -1917,8 +1878,7 @@ class BraceStmtScope final : public AbstractStmtScope {
19171878
Stmt *getStmt() const override { return stmt; }
19181879

19191880
protected:
1920-
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
1921-
DeclConsumer) const override;
1881+
bool lookupLocalsOrMembers(DeclConsumer) const override;
19221882
};
19231883
} // namespace ast_scope
19241884
} // namespace swift

include/swift/AST/NameLookup.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,8 @@ class ASTScope {
681681
/// Flesh out the tree for dumping
682682
void buildFullyExpandedTree();
683683

684-
/// \return the scopes traversed
685-
static llvm::SmallVector<const ast_scope::ASTScopeImpl *, 0>
686-
unqualifiedLookup(SourceFile *, DeclNameRef, SourceLoc,
687-
namelookup::AbstractASTScopeDeclConsumer &);
684+
static void unqualifiedLookup(SourceFile *, DeclNameRef, SourceLoc,
685+
namelookup::AbstractASTScopeDeclConsumer &);
688686

689687
/// Entry point to record the visible statement labels from the given
690688
/// point.

lib/AST/ASTScope.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ using namespace ast_scope;
3838

3939
#pragma mark ASTScope
4040

41-
llvm::SmallVector<const ASTScopeImpl *, 0> ASTScope::unqualifiedLookup(
41+
void ASTScope::unqualifiedLookup(
4242
SourceFile *SF, DeclNameRef name, SourceLoc loc,
4343
namelookup::AbstractASTScopeDeclConsumer &consumer) {
4444
if (auto *s = SF->getASTContext().Stats)
4545
++s->getFrontendCounters().NumASTScopeLookups;
46-
return ASTScopeImpl::unqualifiedLookup(SF, name, loc, consumer);
46+
ASTScopeImpl::unqualifiedLookup(SF, name, loc, consumer);
4747
}
4848

4949
llvm::SmallVector<LabeledStmt *, 4> ASTScope::lookupLabeledStmts(

0 commit comments

Comments
 (0)