Skip to content

astDiagnostics

Description of AST Diagnostics within ROSE

Synopsis

Declared in <src/docs/mrdocs/modules/ast_diagnostics.h>

struct astDiagnostics;

Description

The AST diagnostics support testing and reporting on the AST. Analysis is separated into consistency tests, warnings about questionable AST configurations, and statistical properties of the AST.

‐ Consistency tests are pass/fail and all are required to pass to verify correctness of the AST. ‐ Warning reports describe non‐fatal irregularities that may affect future analyses. The unparser will generally generate good code from an AST which can still contain errors (e.g. the unparser does not require that the symbols in the symbol table be correct, but many forms of program analysis might use this information). ‐ Statistical properties report coverage and distribution of IR nodes to aid debugging.

Current tests are pass/fail and test the following properties: ‐ Parent pointers are verified correct. ‐ File info objects are verified to be correct (none are set to default values such as filename "NULL_FILE", line 0, column 0) except for compiler generated IR nodes. ‐ Pointers to file info objects are verified to be valid pointers. ‐ All file info objects are verified to be unique (non‐shared). ‐ The type of a SgFunctionRefExp is always a SgFunctionType. ‐ ...

There are a number of tests planned for the near future: ‐ SgInitializedName diagnostics. ‐ Correct configuration of SgExpressionRoot (SgReturnStmt). ‐ Complete list in ROSE/proposals/TODO.txt.

There are a number of warnings that are output if certain patterns of IR usage are found: ‐ Uniqueness of file info objects in AST.

A number of warnings are planned for the near future: ‐ Correct usage of SgInitializedName. ‐ etc. (see list in TODO.txt).

The AST has about 240 IR nodes and this section is focused on the statistical usage of IR nodes within the AST. Current statistical properties of the AST supported are: ‐ Percentage of use of each IR node in the AST.

It is easy to imagine additional AST properties to report. Future work will implement a number of tests useful for debugging the AST: ‐ Percentage of AST that passes all tests. ‐ Percentage of AST which generates warnings.

Note: This section was previously excluded from generated documentation because it was incomplete.

Created with MrDocs