@@ -1561,7 +1561,7 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) {
1561
1561
if (!var) // Ignore subscripts
1562
1562
return ;
1563
1563
1564
- class DiagnoseWalker : public ASTWalker {
1564
+ class DiagnoseWalker : public BaseDiagnosticWalker {
1565
1565
ASTContext &Ctx;
1566
1566
VarDecl *Var;
1567
1567
const AccessorDecl *Accessor;
@@ -1577,12 +1577,6 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) {
1577
1577
cast<VarDecl>(DRE->getDecl ())->isSelfParameter ();
1578
1578
}
1579
1579
1580
- MacroWalking getMacroWalkingBehavior () const override {
1581
- // Macro expansions will be walked when they're type-checked, not as
1582
- // part of the surrounding code.
1583
- return MacroWalking::None;
1584
- }
1585
-
1586
1580
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
1587
1581
Expr *subExpr;
1588
1582
bool isStore = false ;
@@ -4548,7 +4542,7 @@ static void checkStmtConditionTrailingClosure(ASTContext &ctx, const Expr *E) {
4548
4542
if (E == nullptr || isa<ErrorExpr>(E)) return ;
4549
4543
4550
4544
// Walk into expressions which might have invalid trailing closures
4551
- class DiagnoseWalker : public ASTWalker {
4545
+ class DiagnoseWalker : public BaseDiagnosticWalker {
4552
4546
ASTContext &Ctx;
4553
4547
4554
4548
void diagnoseIt (const CallExpr *E) {
@@ -4594,12 +4588,6 @@ static void checkStmtConditionTrailingClosure(ASTContext &ctx, const Expr *E) {
4594
4588
public:
4595
4589
DiagnoseWalker (ASTContext &ctx) : Ctx(ctx) { }
4596
4590
4597
- MacroWalking getMacroWalkingBehavior () const override {
4598
- // Macro expansions will be walked when they're type-checked, not as
4599
- // part of the surrounding code.
4600
- return MacroWalking::None;
4601
- }
4602
-
4603
4591
PreWalkResult<ArgumentList *>
4604
4592
walkToArgumentListPre (ArgumentList *args) override {
4605
4593
// Don't walk into an explicit argument list, as trailing closures that
@@ -4669,7 +4657,7 @@ static void checkStmtConditionTrailingClosure(ASTContext &ctx, const Stmt *S) {
4669
4657
4670
4658
namespace {
4671
4659
4672
- class ObjCSelectorWalker : public ASTWalker {
4660
+ class ObjCSelectorWalker : public BaseDiagnosticWalker {
4673
4661
ASTContext &Ctx;
4674
4662
const DeclContext *DC;
4675
4663
Type SelectorTy;
@@ -4719,12 +4707,6 @@ class ObjCSelectorWalker : public ASTWalker {
4719
4707
ObjCSelectorWalker (const DeclContext *dc, Type selectorTy)
4720
4708
: Ctx(dc->getASTContext ()), DC(dc), SelectorTy(selectorTy) { }
4721
4709
4722
- MacroWalking getMacroWalkingBehavior () const override {
4723
- // Macro expansions will be walked when they're type-checked, not as
4724
- // part of the surrounding code.
4725
- return MacroWalking::None;
4726
- }
4727
-
4728
4710
PreWalkResult<Expr *> walkToExprPre (Expr *expr) override {
4729
4711
auto *stringLiteral = dyn_cast<StringLiteralExpr>(expr);
4730
4712
bool fromStringLiteral = false ;
@@ -5231,7 +5213,7 @@ static void diagnoseUnintendedOptionalBehavior(const Expr *E,
5231
5213
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5232
5214
return ;
5233
5215
5234
- class UnintendedOptionalBehaviorWalker : public ASTWalker {
5216
+ class UnintendedOptionalBehaviorWalker : public BaseDiagnosticWalker {
5235
5217
ASTContext &Ctx;
5236
5218
SmallPtrSet<Expr *, 16 > IgnoredExprs;
5237
5219
@@ -5583,12 +5565,6 @@ static void diagnoseUnintendedOptionalBehavior(const Expr *E,
5583
5565
}
5584
5566
}
5585
5567
5586
- MacroWalking getMacroWalkingBehavior () const override {
5587
- // Macro expansions will be walked when they're type-checked, not as
5588
- // part of the surrounding code.
5589
- return MacroWalking::None;
5590
- }
5591
-
5592
5568
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
5593
5569
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5594
5570
return Action::SkipNode (E);
@@ -5624,7 +5600,7 @@ static void diagnoseDeprecatedWritableKeyPath(const Expr *E,
5624
5600
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5625
5601
return ;
5626
5602
5627
- class DeprecatedWritableKeyPathWalker : public ASTWalker {
5603
+ class DeprecatedWritableKeyPathWalker : public BaseDiagnosticWalker {
5628
5604
ASTContext &Ctx;
5629
5605
const DeclContext *DC;
5630
5606
@@ -5658,12 +5634,6 @@ static void diagnoseDeprecatedWritableKeyPath(const Expr *E,
5658
5634
}
5659
5635
}
5660
5636
5661
- MacroWalking getMacroWalkingBehavior () const override {
5662
- // Macro expansions will be walked when they're type-checked, not as
5663
- // part of the surrounding code.
5664
- return MacroWalking::None;
5665
- }
5666
-
5667
5637
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
5668
5638
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5669
5639
return Action::SkipNode (E);
@@ -5687,7 +5657,7 @@ static void diagnoseDeprecatedWritableKeyPath(const Expr *E,
5687
5657
5688
5658
static void maybeDiagnoseCallToKeyValueObserveMethod (const Expr *E,
5689
5659
const DeclContext *DC) {
5690
- class KVOObserveCallWalker : public ASTWalker {
5660
+ class KVOObserveCallWalker : public BaseDiagnosticWalker {
5691
5661
const ASTContext &C;
5692
5662
5693
5663
public:
@@ -5745,12 +5715,6 @@ static void maybeDiagnoseCallToKeyValueObserveMethod(const Expr *E,
5745
5715
}
5746
5716
}
5747
5717
5748
- MacroWalking getMacroWalkingBehavior () const override {
5749
- // Macro expansions will be walked when they're type-checked, not as
5750
- // part of the surrounding code.
5751
- return MacroWalking::None;
5752
- }
5753
-
5754
5718
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
5755
5719
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5756
5720
return Action::SkipNode (E);
@@ -5771,7 +5735,7 @@ static void maybeDiagnoseCallToKeyValueObserveMethod(const Expr *E,
5771
5735
static void diagnoseExplicitUseOfLazyVariableStorage (const Expr *E,
5772
5736
const DeclContext *DC) {
5773
5737
5774
- class ExplicitLazyVarStorageAccessFinder : public ASTWalker {
5738
+ class ExplicitLazyVarStorageAccessFinder : public BaseDiagnosticWalker {
5775
5739
const ASTContext &C;
5776
5740
5777
5741
public:
@@ -5798,12 +5762,6 @@ static void diagnoseExplicitUseOfLazyVariableStorage(const Expr *E,
5798
5762
}
5799
5763
}
5800
5764
5801
- MacroWalking getMacroWalkingBehavior () const override {
5802
- // Macro expansions will be walked when they're type-checked, not as
5803
- // part of the surrounding code.
5804
- return MacroWalking::None;
5805
- }
5806
-
5807
5765
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
5808
5766
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5809
5767
return Action::SkipNode (E);
@@ -5822,7 +5780,7 @@ static void diagnoseExplicitUseOfLazyVariableStorage(const Expr *E,
5822
5780
}
5823
5781
5824
5782
static void diagnoseComparisonWithNaN (const Expr *E, const DeclContext *DC) {
5825
- class ComparisonWithNaNFinder : public ASTWalker {
5783
+ class ComparisonWithNaNFinder : public BaseDiagnosticWalker {
5826
5784
const ASTContext &C;
5827
5785
5828
5786
public:
@@ -5931,12 +5889,6 @@ static void diagnoseComparisonWithNaN(const Expr *E, const DeclContext *DC) {
5931
5889
}
5932
5890
}
5933
5891
5934
- MacroWalking getMacroWalkingBehavior () const override {
5935
- // Macro expansions will be walked when they're type-checked, not as
5936
- // part of the surrounding code.
5937
- return MacroWalking::None;
5938
- }
5939
-
5940
5892
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
5941
5893
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5942
5894
return Action::SkipNode (E);
@@ -5959,19 +5911,13 @@ static void diagUnqualifiedAccessToMethodNamedSelf(const Expr *E,
5959
5911
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5960
5912
return ;
5961
5913
5962
- class DiagnoseWalker : public ASTWalker {
5914
+ class DiagnoseWalker : public BaseDiagnosticWalker {
5963
5915
ASTContext &Ctx;
5964
5916
const DeclContext *DC;
5965
5917
5966
5918
public:
5967
5919
DiagnoseWalker (const DeclContext *DC) : Ctx(DC->getASTContext ()), DC(DC) {}
5968
5920
5969
- MacroWalking getMacroWalkingBehavior () const override {
5970
- // Macro expansions will be walked when they're type-checked, not as
5971
- // part of the surrounding code.
5972
- return MacroWalking::None;
5973
- }
5974
-
5975
5921
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
5976
5922
if (!E || isa<ErrorExpr>(E) || !E->getType ())
5977
5923
return Action::SkipNode (E);
@@ -6024,7 +5970,7 @@ static void diagUnqualifiedAccessToMethodNamedSelf(const Expr *E,
6024
5970
static void
6025
5971
diagnoseDictionaryLiteralDuplicateKeyEntries (const Expr *E,
6026
5972
const DeclContext *DC) {
6027
- class DiagnoseWalker : public ASTWalker {
5973
+ class DiagnoseWalker : public BaseDiagnosticWalker {
6028
5974
ASTContext &Ctx;
6029
5975
6030
5976
private:
@@ -6123,12 +6069,6 @@ diagnoseDictionaryLiteralDuplicateKeyEntries(const Expr *E,
6123
6069
public:
6124
6070
DiagnoseWalker (const DeclContext *DC) : Ctx(DC->getASTContext ()) {}
6125
6071
6126
- MacroWalking getMacroWalkingBehavior () const override {
6127
- // Macro expansions will be walked when they're type-checked, not as
6128
- // part of the surrounding code.
6129
- return MacroWalking::None;
6130
- }
6131
-
6132
6072
PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
6133
6073
const auto *DLE = dyn_cast_or_null<DictionaryExpr>(E);
6134
6074
if (!DLE)
0 commit comments