slang-netlist  0.10.0
Loading...
Searching...
No Matches
slang::report::ReportVisitorBase< Derived, Info > Class Template Reference

#include <ReportVisitorBase.hpp>

Inheritance diagram for slang::report::ReportVisitorBase< Derived, Info >:

Public Member Functions

 ReportVisitorBase (ast::Compilation &compilation)
void setNameFilters (std::vector< std::string > filters)
void report (FormatBuffer &buffer)
 Render the collected information as a human-readable table.
void report (JsonWriter &writer)
 Render the collected information as a JSON array of objects.

Protected Member Functions

auto locationStr (SourceLocation loc) const -> std::string
 Format a source location using the compilation's SourceManager.
auto nameMatches (std::string_view name) const -> bool

Protected Attributes

ast::Compilation & compilation
std::vector< Info > items
std::vector< std::string > nameFilters

Detailed Description

template<typename Derived, typename Info>
class slang::report::ReportVisitorBase< Derived, Info >

CRTP base for the report visitors. Owns the shared Compilation& reference and the collected-item storage, and provides the table and JSON rendering loops that delegate per-item formatting to the derived class.

A derived class D with item type Info must provide:

  • auto tableHeader() const -> netlist::Utilities::Row;
  • void appendItemRows(netlist::Utilities::Table&, Info const&) const;
  • void emitJsonItem(JsonWriter&, Info const&) const; and the relevant handle(...) methods for the AST visitor. Each handle should consult nameMatches(symbol.getHierarchicalPath()) before recording to honour any --name filters set by the caller.

Constructor & Destructor Documentation

◆ ReportVisitorBase()

template<typename Derived, typename Info>
slang::report::ReportVisitorBase< Derived, Info >::ReportVisitorBase ( ast::Compilation & compilation)
inlineexplicit

Member Function Documentation

◆ locationStr()

template<typename Derived, typename Info>
auto slang::report::ReportVisitorBase< Derived, Info >::locationStr ( SourceLocation loc) const -> std::string
inlineprotected

Format a source location using the compilation's SourceManager.

◆ nameMatches()

template<typename Derived, typename Info>
auto slang::report::ReportVisitorBase< Derived, Info >::nameMatches ( std::string_view name) const -> bool
inlineprotected

Return true if no name filters are set, or if name matches at least one of them (glob syntax per netlist::wildcardMatch).

◆ report() [1/2]

template<typename Derived, typename Info>
void slang::report::ReportVisitorBase< Derived, Info >::report ( FormatBuffer & buffer)
inline

Render the collected information as a human-readable table.

◆ report() [2/2]

template<typename Derived, typename Info>
void slang::report::ReportVisitorBase< Derived, Info >::report ( JsonWriter & writer)
inline

Render the collected information as a JSON array of objects.

◆ setNameFilters()

template<typename Derived, typename Info>
void slang::report::ReportVisitorBase< Derived, Info >::setNameFilters ( std::vector< std::string > filters)
inline

Restrict reporting to symbols whose hierarchical path matches at least one of filters (glob syntax per netlist::wildcardMatch: */? stay within a single path segment, **/... cross boundaries). An empty list disables filtering.

Member Data Documentation

◆ compilation

template<typename Derived, typename Info>
ast::Compilation& slang::report::ReportVisitorBase< Derived, Info >::compilation
protected

◆ items

template<typename Derived, typename Info>
std::vector<Info> slang::report::ReportVisitorBase< Derived, Info >::items
protected

◆ nameFilters

template<typename Derived, typename Info>
std::vector<std::string> slang::report::ReportVisitorBase< Derived, Info >::nameFilters
protected

The documentation for this class was generated from the following file: