Add more missing ASTWalker macro behavior entries

This commit is contained in:
Doug Gregor
2023-02-28 19:13:02 -08:00
parent 200f2340d9
commit 7a1c558899
6 changed files with 56 additions and 0 deletions

View File

@@ -2404,6 +2404,10 @@ isApplicable(const ResolvedRangeInfo &Info, DiagnosticEngine &Diag) {
bool ConditionUseOnlyAllowedFunctions = false;
StringRef ExpectName;
MacroWalking getMacroWalkingBehavior() const override {
return MacroWalking::Arguments;
}
PostWalkResult<Expr *> walkToExprPost(Expr *E) override {
if (E->getKind() != ExprKind::DeclRef)
return Action::Continue(E);
@@ -2502,6 +2506,10 @@ bool RefactoringActionConvertToSwitchStmt::performChange() {
public:
std::string VarName;
MacroWalking getMacroWalkingBehavior() const override {
return MacroWalking::Arguments;
}
PostWalkResult<Expr *> walkToExprPost(Expr *E) override {
if (E->getKind() != ExprKind::DeclRef)
return Action::Continue(E);
@@ -2519,6 +2527,10 @@ bool RefactoringActionConvertToSwitchStmt::performChange() {
SmallString<64> ConditionalPattern = SmallString<64>();
MacroWalking getMacroWalkingBehavior() const override {
return MacroWalking::Arguments;
}
PostWalkResult<Expr *> walkToExprPost(Expr *E) override {
auto *BE = dyn_cast<BinaryExpr>(E);
if (!BE)
@@ -3669,6 +3681,10 @@ private:
public:
SynthesizedCodablePrinter(ASTPrinter &Printer) : Printer(Printer) {}
MacroWalking getMacroWalkingBehavior() const override {
return MacroWalking::Arguments;
}
PreWalkAction walkToDeclPre(Decl *D) override {
auto *VD = dyn_cast<ValueDecl>(D);
if (!VD)
@@ -3849,6 +3865,10 @@ static NumberLiteralExpr *getTrailingNumberLiteral(ResolvedCursorInfoPtr Tok) {
explicit FindLiteralNumber(Expr *parent) : parent(parent) { }
MacroWalking getMacroWalkingBehavior() const override {
return MacroWalking::Arguments;
}
PreWalkResult<Expr *> walkToExprPre(Expr *expr) override {
if (auto *literal = dyn_cast<NumberLiteralExpr>(expr)) {
// The sub-expression must have the same start loc with the outermost
@@ -5434,6 +5454,10 @@ private:
: ErrParam(ErrParam) {}
bool foundUnwrap() const { return FoundUnwrap; }
MacroWalking getMacroWalkingBehavior() const override {
return MacroWalking::Arguments;
}
PreWalkResult<Expr *> walkToExprPre(Expr *E) override {
// Don't walk into ternary conditionals as they may have additional
// conditions such as err != nil that make a force unwrap now valid.