6#include "slang/ast/ASTVisitor.h"
7#include "slang/ast/Compilation.h"
8#include "slang/text/FormatBuffer.h"
9#include "slang/text/Json.h"
10#include "slang/text/SourceLocation.h"
30template <
typename Derived,
typename Info>
32 :
public ast::ASTVisitor<Derived, ast::VisitFlags::Expressions |
33 ast::VisitFlags::Canonical> {
50 auto subject = std::string(name);
73 auto header =
static_cast<Derived
const *
>(
this)->tableHeader();
75 for (
auto const &item :
items) {
76 static_cast<Derived
const *
>(
this)->appendItemRows(table, item);
84 for (
auto const &item :
items) {
85 static_cast<Derived
const *
>(
this)->emitJsonItem(writer, item);
ast::Compilation & compilation
Definition ReportVisitorBase.hpp:35
ReportVisitorBase(ast::Compilation &compilation)
Definition ReportVisitorBase.hpp:60
void report(JsonWriter &writer)
Render the collected information as a JSON array of objects.
Definition ReportVisitorBase.hpp:82
std::vector< std::string > nameFilters
Definition ReportVisitorBase.hpp:37
auto locationStr(SourceLocation loc) const -> std::string
Format a source location using the compilation's SourceManager.
Definition ReportVisitorBase.hpp:40
auto nameMatches(std::string_view name) const -> bool
Definition ReportVisitorBase.hpp:46
void report(FormatBuffer &buffer)
Render the collected information as a human-readable table.
Definition ReportVisitorBase.hpp:72
void setNameFilters(std::vector< std::string > filters)
Definition ReportVisitorBase.hpp:67
std::vector< Info > items
Definition ReportVisitorBase.hpp:36
auto wildcardMatch(const char *text, const char *pattern) -> bool
Definition Wildcard.hpp:26
Definition ReportDrivers.hpp:12
std::vector< Row > Table
Definition Utilities.hpp:33
static auto locationStr(ast::Compilation const &compilation, SourceLocation location)
Return a string representation of a slang SourceLocation.
Definition Utilities.hpp:21
static auto formatTable(FormatBuffer &buffer, const Row &header, const Table &rows, TableFormatConfig cfg={})
Format a table of data into the given format buffer.
Definition Utilities.hpp:44