@@ -236,22 +236,16 @@ class ASTScopeImpl : public ASTAllocated<ASTScopeImpl> {
236
236
237
237
virtual NullablePtr<AbstractClosureExpr> getClosureIfClosureScope () const ;
238
238
virtual NullablePtr<const BraceStmtScope> getAsBraceStmtScope () const ;
239
- virtual ASTContext &getASTContext () const ;
240
- virtual NullablePtr<Decl> getDeclIfAny () const { return nullptr ; };
241
- virtual NullablePtr<Stmt> getStmtIfAny () const { return nullptr ; };
242
- virtual NullablePtr<Expr> getExprIfAny () const { return nullptr ; };
243
- virtual NullablePtr<DeclAttribute> getDeclAttributeIfAny () const {
244
- return nullptr ;
245
- }
246
-
247
- virtual NullablePtr<MacroExpansionDecl> getFreestandingMacro () const {
248
- return nullptr ;
249
- }
239
+ ASTContext &getASTContext () const ;
240
+ NullablePtr<Decl> getDeclIfAny () const ;
241
+ NullablePtr<Stmt> getStmtIfAny () const ;
242
+ NullablePtr<Expr> getExprIfAny () const ;
243
+ NullablePtr<DeclAttribute> getDeclAttributeIfAny () const ;
250
244
251
245
#pragma mark - debugging and printing
252
246
253
247
public:
254
- virtual const SourceFile *getSourceFile () const ;
248
+ const SourceFile *getSourceFile () const ;
255
249
StringRef getClassName () const ;
256
250
257
251
// / Print out this scope for debugging/reporting purposes.
@@ -453,10 +447,8 @@ class ASTSourceFileScope final : public ASTScopeImpl {
453
447
454
448
void expandFunctionBody (AbstractFunctionDecl *AFD);
455
449
456
- const SourceFile *getSourceFile () const override ;
457
450
NullablePtr<const void > addressForPrinting () const override { return SF; }
458
451
459
- ASTContext &getASTContext () const override ;
460
452
bool ignoreInDebugInfo () const override { return true ; }
461
453
462
454
protected:
@@ -592,7 +584,6 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
592
584
virtual void expandBody (ScopeCreator &);
593
585
594
586
virtual Decl *getDecl () const = 0;
595
- NullablePtr<Decl> getDeclIfAny () const override { return getDecl (); }
596
587
597
588
private:
598
589
AnnotatedInsertionPoint
@@ -825,7 +816,6 @@ class AbstractFunctionDeclScope final : public ASTScopeImpl {
825
816
void printSpecifics (llvm::raw_ostream &out) const override ;
826
817
827
818
public:
828
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
829
819
Decl *getDecl () const { return decl; }
830
820
831
821
protected:
@@ -889,7 +879,6 @@ class FunctionBodyScope : public ASTScopeImpl {
889
879
public:
890
880
SourceRange
891
881
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
892
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
893
882
Decl *getDecl () const { return decl; }
894
883
bool ignoreInDebugInfo () const override { return true ; }
895
884
@@ -921,7 +910,6 @@ class DefaultArgumentInitializerScope final : public ASTScopeImpl {
921
910
void expandAScopeThatDoesNotCreateANewInsertionPoint (ScopeCreator &);
922
911
SourceRange
923
912
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
924
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
925
913
Decl *getDecl () const { return decl; }
926
914
bool ignoreInDebugInfo () const override { return true ; }
927
915
@@ -953,9 +941,6 @@ class CustomAttributeScope final : public ASTScopeImpl {
953
941
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
954
942
NullablePtr<const void > addressForPrinting () const override { return decl; }
955
943
956
- NullablePtr<DeclAttribute> getDeclAttributeIfAny () const override {
957
- return attr;
958
- }
959
944
bool ignoreInDebugInfo () const override { return true ; }
960
945
961
946
private:
@@ -1003,7 +988,6 @@ class AbstractPatternEntryScope : public ASTScopeImpl {
1003
988
void printSpecifics (llvm::raw_ostream &out) const override ;
1004
989
1005
990
public:
1006
- NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1007
991
Decl *getDecl () const { return decl; }
1008
992
};
1009
993
@@ -1151,7 +1135,6 @@ class CaptureListScope final : public ASTScopeImpl {
1151
1135
public:
1152
1136
SourceRange
1153
1137
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1154
- NullablePtr<Expr> getExprIfAny () const override { return expr; }
1155
1138
Expr *getExpr () const { return expr; }
1156
1139
bool lookupLocalsOrMembers (DeclConsumer) const override ;
1157
1140
@@ -1177,7 +1160,6 @@ class ClosureParametersScope final : public ASTScopeImpl {
1177
1160
}
1178
1161
std::pair<CatchNode, const BraceStmtScope *> getCatchNodeBody () const override ;
1179
1162
1180
- NullablePtr<Expr> getExprIfAny () const override { return closureExpr; }
1181
1163
Expr *getExpr () const { return closureExpr; }
1182
1164
bool ignoreInDebugInfo () const override { return true ; }
1183
1165
@@ -1215,7 +1197,6 @@ class TopLevelCodeScope final : public ASTScopeImpl {
1215
1197
public:
1216
1198
SourceRange
1217
1199
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1218
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1219
1200
Decl *getDecl () const { return decl; }
1220
1201
1221
1202
static bool classof (const ASTScopeImpl *scope) {
@@ -1242,7 +1223,7 @@ class SpecializeAttributeScope final : public ASTScopeImpl {
1242
1223
return specializeAttr;
1243
1224
}
1244
1225
1245
- NullablePtr< DeclAttribute> getDeclAttributeIfAny () const override {
1226
+ DeclAttribute * getDeclAttr () const {
1246
1227
return specializeAttr;
1247
1228
}
1248
1229
@@ -1276,7 +1257,7 @@ class DifferentiableAttributeScope final : public ASTScopeImpl {
1276
1257
return differentiableAttr;
1277
1258
}
1278
1259
1279
- NullablePtr< DeclAttribute> getDeclAttributeIfAny () const override {
1260
+ DeclAttribute * getDeclAttr () const {
1280
1261
return differentiableAttr;
1281
1262
}
1282
1263
@@ -1313,7 +1294,6 @@ class SubscriptDeclScope final : public ASTScopeImpl {
1313
1294
void printSpecifics (llvm::raw_ostream &out) const override ;
1314
1295
1315
1296
public:
1316
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1317
1297
Decl *getDecl () const { return decl; }
1318
1298
1319
1299
protected:
@@ -1336,7 +1316,6 @@ class EnumElementScope : public ASTScopeImpl {
1336
1316
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1337
1317
1338
1318
ASTScopeImpl *expandSpecifically (ScopeCreator &) override ;
1339
- NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1340
1319
Decl *getDecl () const { return decl; }
1341
1320
1342
1321
private:
@@ -1369,7 +1348,6 @@ class MacroDeclScope final : public ASTScopeImpl {
1369
1348
void printSpecifics (llvm::raw_ostream &out) const override ;
1370
1349
1371
1350
public:
1372
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1373
1351
Decl *getDecl () const { return decl; }
1374
1352
1375
1353
protected:
@@ -1424,15 +1402,10 @@ class MacroExpansionDeclScope final : public ASTScopeImpl {
1424
1402
SourceRange
1425
1403
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1426
1404
1427
- NullablePtr<MacroExpansionDecl> getFreestandingMacro () const override {
1428
- return decl;
1429
- }
1430
-
1431
1405
protected:
1432
1406
void printSpecifics (llvm::raw_ostream &out) const override ;
1433
1407
1434
1408
public:
1435
- virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1436
1409
Decl *getDecl () const { return decl; }
1437
1410
1438
1411
static bool classof (const ASTScopeImpl *scope) {
@@ -1448,7 +1421,6 @@ class AbstractStmtScope : public ASTScopeImpl {
1448
1421
SourceRange
1449
1422
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1450
1423
virtual Stmt *getStmt () const = 0;
1451
- NullablePtr<Stmt> getStmtIfAny () const override { return getStmt (); }
1452
1424
1453
1425
protected:
1454
1426
bool isLabeledStmtLookupTerminator () const override ;
0 commit comments