This is an archive of the discontinued LLVM Phabricator instance.

Added tests for RecursiveASTVisitor for AST nodes that are special cased
ClosedPublic

Authored by gribozavr on Jun 30 2020, 6:50 AM.

Details

Summary

RecursiveASTVisitor has special code for handling operator AST nodes,
specifically, unary, binary, and compound assignment operators. In this
change I'm adding tests for operator AST nodes that follow the existing
pattern of tests for the CallExpr node (an AST node that triggers the
common code path).

Diff Detail

Event Timeline

gribozavr created this revision.Jun 30 2020, 6:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2020, 6:50 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
gribozavr2 marked an inline comment as done.Jun 30 2020, 6:53 AM
gribozavr2 added a subscriber: gribozavr2.
gribozavr2 added inline comments.
clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp
398

Phabricator shows the diff as a modification, but it is actually an addition -- new tests are just very similar to existing tests for binary operators, so the diff algorithm is confused. You can find old tests for binary operators below, shown as code being added.

ymandel accepted this revision.Jun 30 2020, 9:27 AM
This revision is now accepted and ready to land.Jun 30 2020, 9:27 AM
eduucaldas accepted this revision.Jun 30 2020, 10:57 PM
eduucaldas added inline comments.
clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp
501

A question came to mind: " Does WalkUpFromUnaryMinus walk up to WalkUpFromUnaryOperator? " Perhaps that could be included in a test.

gribozavr2 marked an inline comment as done.Jul 1 2020, 4:31 AM
gribozavr2 added inline comments.
clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp
501

Good question -- but it is already covered by the StmtCallbacks_WalkUpFromUnaryMinus test.

This revision was automatically updated to reflect the committed changes.