Package it.unive.lisa.checks.syntactic
Class CheckTool
- java.lang.Object
-
- it.unive.lisa.checks.syntactic.CheckTool
-
- Direct Known Subclasses:
CheckToolWithAnalysisResults
public class CheckTool extends java.lang.Object
An auxiliary tool that can be used by checks during their execution. It provides reporting capabilities, as well as access to analysis singletons, such as executed semantic analyses.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CheckTool(CheckTool other)
Build the tool, shallow-copying the set of warnings from the given one.CheckTool(LiSAConfiguration configuration, FileManager fileManager)
Build the tool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LiSAConfiguration
getConfiguration()
Yields theLiSAConfiguration
of the current analysis.FileManager
getFileManager()
Yields theFileManager
of the current analysis.java.util.Collection<Warning>
getWarnings()
Returns an unmodifiable view of the warnings that have been generated up to now using this tool.void
warn(java.lang.String message)
Reports a new warning that is meant to be a generic warning on the program.void
warnOn(CFG cfg, java.lang.String message)
Reports a new warning with the given message on the declaration of the given cfg.void
warnOn(CodeMemberDescriptor descriptor, java.lang.String message)
Reports a new warning with the given message on the declaration of the cfg represented by the given descriptor.void
warnOn(Expression expression, java.lang.String message)
Reports a new warning with the given message on the given expression.void
warnOn(Statement statement, java.lang.String message)
Reports a new warning with the given message on the given statement.void
warnOn(Unit unit, Global global, java.lang.String message)
Reports a new warning with the given message on the declaration of the given global.void
warnOn(Unit unit, java.lang.String message)
Reports a new warning with the given message on the declaration of the given unit.
-
-
-
Constructor Detail
-
CheckTool
public CheckTool(LiSAConfiguration configuration, FileManager fileManager)
Build the tool.- Parameters:
configuration
- the configuration of the analysisfileManager
- the file manager of the analysis
-
CheckTool
protected CheckTool(CheckTool other)
Build the tool, shallow-copying the set of warnings from the given one.- Parameters:
other
- the original tool to copy
-
-
Method Detail
-
getConfiguration
public LiSAConfiguration getConfiguration()
Yields theLiSAConfiguration
of the current analysis.- Returns:
- the configuration
-
getFileManager
public FileManager getFileManager()
Yields theFileManager
of the current analysis.- Returns:
- the file manager
-
warn
public void warn(java.lang.String message)
Reports a new warning that is meant to be a generic warning on the program. For warnings related to one of the components of the program (e.g., a CFG, a statement, ...) rely on the other methods provided by this class.- Parameters:
message
- the message of the warning
-
warnOn
public void warnOn(Unit unit, java.lang.String message)
Reports a new warning with the given message on the declaration of the given unit.- Parameters:
unit
- the unit to warn onmessage
- the message of the warning
-
warnOn
public void warnOn(Unit unit, Global global, java.lang.String message)
Reports a new warning with the given message on the declaration of the given global.- Parameters:
unit
- the unit containing the global to warn onglobal
- the global to warn onmessage
- the message of the warning
-
warnOn
public void warnOn(CFG cfg, java.lang.String message)
Reports a new warning with the given message on the declaration of the given cfg.- Parameters:
cfg
- the cfg to warn onmessage
- the message of the warning
-
warnOn
public void warnOn(CodeMemberDescriptor descriptor, java.lang.String message)
Reports a new warning with the given message on the declaration of the cfg represented by the given descriptor.- Parameters:
descriptor
- the descriptor cfg to warn onmessage
- the message of the warning
-
warnOn
public void warnOn(Statement statement, java.lang.String message)
Reports a new warning with the given message on the given statement. Ifstatement
is an instance ofExpression
, thenwarnOn(Expression, String)
is invoked.- Parameters:
statement
- the statement to warn onmessage
- the message of the warning
-
warnOn
public void warnOn(Expression expression, java.lang.String message)
Reports a new warning with the given message on the given expression.- Parameters:
expression
- the expression to warn onmessage
- the message of the warning
-
getWarnings
public java.util.Collection<Warning> getWarnings()
Returns an unmodifiable view of the warnings that have been generated up to now using this tool.- Returns:
- a view of the warnings
-
-