@@ -267,26 +267,26 @@ void SwiftASTManipulatorBase::DoInitialization() {
267
267
// / This is an optional extension holding the above function.
268
268
swift::ExtensionDecl *extension_decl = nullptr ;
269
269
270
- bool walkToDeclPre (swift::Decl *D) override {
270
+ PreWalkAction walkToDeclPre (swift::Decl *D) override {
271
271
auto *FD = llvm::dyn_cast<swift::FuncDecl>(D);
272
272
// Traverse into any non-function-decls.
273
273
if (!FD)
274
- return true ;
274
+ return Action::Continue () ;
275
275
276
276
if (!FD->getAttrs ().hasAttribute <swift::LLDBDebuggerFunctionAttr>())
277
- return false ;
277
+ return Action::SkipChildren () ;
278
278
279
279
// Walk up the DeclContext chain, searching for an extension.
280
280
for (auto *DC = FD->getDeclContext (); DC; DC = DC->getParent ()) {
281
281
if (auto *extension = llvm::dyn_cast<swift::ExtensionDecl>(DC)) {
282
282
extension_decl = extension;
283
283
ext_method_decl = FD;
284
- return false ;
284
+ return Action::SkipChildren () ;
285
285
}
286
286
}
287
287
// Not in an extenstion,
288
288
toplevel_decl = FD;
289
- return false ;
289
+ return Action::SkipChildren () ;
290
290
}
291
291
};
292
292
@@ -354,15 +354,15 @@ void SwiftASTManipulator::FindSpecialNames(
354
354
SpecialNameFinder (NameVector &names, llvm::StringRef &prefix)
355
355
: m_names(names), m_prefix(prefix) {}
356
356
357
- std::pair< bool , swift::Expr *> walkToExprPre (swift::Expr *E) override {
357
+ PreWalkResult< swift::Expr *> walkToExprPre (swift::Expr *E) override {
358
358
if (auto *UDRE = llvm::dyn_cast<swift::UnresolvedDeclRefExpr>(E)) {
359
359
swift::Identifier name = UDRE->getName ().getBaseIdentifier ();
360
360
361
361
if (m_prefix.empty () || name.str ().startswith (m_prefix))
362
362
m_names.push_back (name);
363
363
}
364
364
365
- return { true , E} ;
365
+ return Action::Continue (E) ;
366
366
}
367
367
368
368
private:
@@ -476,44 +476,44 @@ bool SwiftASTManipulator::RewriteResult() {
476
476
m_decl_context = decl_context;
477
477
}
478
478
479
- bool walkToDeclPre (swift::Decl *D) override {
479
+ PreWalkAction walkToDeclPre (swift::Decl *D) override {
480
480
switch (D->getKind ()) {
481
- default : return true ;
481
+ default : return Action::Continue () ;
482
482
483
483
// Don't step into function declarations, they may have returns, but we
484
484
// don't want to instrument them.
485
485
case swift::DeclKind::Accessor:
486
486
case swift::DeclKind::Func:
487
487
case swift::DeclKind::Class:
488
488
case swift::DeclKind::Struct:
489
- return false ;
489
+ return Action::SkipChildren () ;
490
490
}
491
491
}
492
492
493
- std::pair< bool , swift::Expr *> walkToExprPre (swift::Expr *expr) override {
493
+ PreWalkResult< swift::Expr *> walkToExprPre (swift::Expr *expr) override {
494
494
switch (expr->getKind ()) {
495
- default : return { true , expr} ;
495
+ default : return Action::Continue ( expr) ;
496
496
497
497
// Don't step into closure definitions, they may have returns, but we
498
498
// don't want to instrument them either.
499
499
case swift::ExprKind::Closure:
500
- return { false , expr} ;
500
+ return Action::SkipChildren ( expr) ;
501
501
}
502
502
}
503
503
504
- swift::Stmt *walkToStmtPost (swift::Stmt *S) override {
504
+ PostWalkResult< swift::Stmt *> walkToStmtPost (swift::Stmt *S) override {
505
505
auto *RS = swift::dyn_cast<swift::ReturnStmt>(S);
506
506
if (!RS || !RS->getResult ())
507
- return S ;
507
+ return Action::Continue (S) ;
508
508
509
509
if (swift::Expr *RE = RS->getResult ()) {
510
510
if (swift::Stmt *S =
511
511
m_manipulator.ConvertExpressionToTmpReturnVarAccess (
512
512
RE, RS->getStartLoc (), /* add_return=*/ true , m_decl_context))
513
- return S ;
513
+ return Action::Continue (S) ;
514
514
}
515
515
516
- return S ;
516
+ return Action::Continue (S) ;
517
517
}
518
518
519
519
private:
@@ -629,9 +629,9 @@ void SwiftASTManipulator::MakeDeclarationsPublic() {
629
629
return true ;
630
630
}
631
631
632
- bool walkToDeclPre (swift::Decl *D) override {
632
+ PreWalkAction walkToDeclPre (swift::Decl *D) override {
633
633
if (!canMakePublic (D))
634
- return true ;
634
+ return Action::Continue () ;
635
635
636
636
if (auto *VD = llvm::dyn_cast<swift::ValueDecl>(D)) {
637
637
auto access = swift::AccessLevel::Public;
@@ -650,7 +650,7 @@ void SwiftASTManipulator::MakeDeclarationsPublic() {
650
650
if (auto *ASD = llvm::dyn_cast<swift::AbstractStorageDecl>(D))
651
651
ASD->overwriteSetterAccess (access);
652
652
}
653
- return true ;
653
+ return Action::Continue () ;
654
654
}
655
655
};
656
656
0 commit comments