Skip to content

Commit

Permalink
Fix tidy unit tests after visitor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Jun 30, 2023
1 parent f356032 commit 37a3765
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions include/slang/ast/ASTVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ class ASTVisitor {

/// @brief Creates an ASTVisitor out of the provided handler functions.
///
/// The provided callable arguments must take two parameters, the first of which
/// is the visitor object itself (so that you can call visitDefault on it if
/// desired) and the second is the AST type to match against.
///
/// For example, to create a visitor that will count all of the BinaryExpressions
/// in an AST:
///
Expand Down
2 changes: 1 addition & 1 deletion tools/tidy/src/style/AlwaysCombNonBlocking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct MainVisitor : public TidyVisitor, ASTVisitor<MainVisitor, true, false> {
NEEDS_SKIP_SYMBOL(symbol)
if (symbol.procedureKind == ProceduralBlockKind::AlwaysComb) {
bool hasNonBlockingAssignment = false;
symbol.visitStmts(makeVisitor([&](const AssignmentExpression& expr) {
symbol.visitStmts(makeVisitor([&](auto&, const AssignmentExpression& expr) {
if (expr.isNonBlocking()) {
hasNonBlockingAssignment = true;
}
Expand Down
7 changes: 4 additions & 3 deletions tools/tidy/src/style/AlwaysFFBlocking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ struct MainVisitor : public TidyVisitor, ASTVisitor<MainVisitor, true, false> {
if (symbol.procedureKind == ProceduralBlockKind::AlwaysFF) {
// Collect all declared local variables
std::vector<std::string_view> locals;
symbol.visitStmts(makeVisitor(
[&](const VariableDeclStatement& decl) { locals.push_back(decl.symbol.name); }));
symbol.visitStmts(makeVisitor([&](auto&, const VariableDeclStatement& decl) {
locals.push_back(decl.symbol.name);
}));

bool hasBlockingAssignments = false;
symbol.visitStmts(makeVisitor([&](const AssignmentExpression& expr) {
symbol.visitStmts(makeVisitor([&](auto&, const AssignmentExpression& expr) {
if (expr.isBlocking()) {
auto identifier = getIdentifier(expr.left());
if (identifier && std::find(locals.begin(), locals.end(), identifier.value()) ==
Expand Down

0 comments on commit 37a3765

Please sign in to comment.