slang::analysis::AnalysisManager class

The analysis manager coordinates running various analyses on AST symbols.

Analysis is done downstream from one or more Compilation objects. Once a design has an AST successfully built, analysis passes can be run to check for various issues or extract information.

Constructors, destructors, conversion operators

AnalysisManager(AnalysisOptions options = {}) explicit
Default constructor for the analysis manager.

Public functions

auto getOptions() const -> const AnalysisOptions&
Gets the set of options used to construct the analysis manager.
auto hasFlag(bitmask<AnalysisFlags> flags) const -> bool
Returns true if the given flag(s) are enabled for this analysis.
auto analyze(const ast::Compilation& compilation) -> AnalyzedDesign
Analyzes the given compilation and returns a representation of the design.
auto getDrivers(const ast::ValueSymbol& symbol) const -> DriverList
Returns all of the known drivers for the given symbol.
auto getDiagnostics(const SourceManager* sourceManager) -> Diagnostics
Collects and returns all issued analysis diagnostics.
auto analyzeScopeBlocking(const ast::Scope& scope, const AnalyzedProcedure* parentProcedure = nullptr) -> const AnalyzedScope&
Analyzes the given scope, in blocking fashion.
auto getAnalyzedScope(const ast::Scope& scope) const -> const AnalyzedScope*
Returns the results of a previous analysis of a scope, if available.
auto getAnalyzedSubroutine(const ast::SubroutineSymbol& symbol) const -> const AnalyzedProcedure*
Gets the result of analyzing a subroutine, if available.
auto addAnalyzedSubroutine(const ast::SubroutineSymbol& symbol, std::unique_ptr<AnalyzedProcedure> procedure) -> const AnalyzedProcedure*
Adds a new analyzed subroutine to the manager's cache for later lookup.
void noteDriver(const ast::Expression& expr, const ast::Symbol& containingSymbol)
Notes that the given expression is a driver and should be added to the driver tracker.
void noteDrivers(std::span<const SymbolDriverListPair> drivers)
Notes the existence of the given symbol value drivers.
void getFunctionDrivers(const ast::CallExpression& expr, const ast::Symbol& containingSymbol, SmallSet<const ast::SubroutineSymbol*, 2>& visited, std::vector<SymbolDriverListPair>& drivers)
Helper method to get the indirect drivers from a call to a function.

Function documentation

AnalyzedDesign slang::analysis::AnalysisManager::analyze(const ast::Compilation& compilation)

Analyzes the given compilation and returns a representation of the design.

Diagnostics slang::analysis::AnalysisManager::getDiagnostics(const SourceManager* sourceManager)

Collects and returns all issued analysis diagnostics.

If sourceManager is provided it will be used to sort the diagnostics.

const AnalyzedScope& slang::analysis::AnalysisManager::analyzeScopeBlocking(const ast::Scope& scope, const AnalyzedProcedure* parentProcedure = nullptr)

Analyzes the given scope, in blocking fashion.

const AnalyzedProcedure* slang::analysis::AnalysisManager::getAnalyzedSubroutine(const ast::SubroutineSymbol& symbol) const

Gets the result of analyzing a subroutine, if available.

Otherwise returns nullptr.