Skip to content

enable full use of -verify in 3C #425

@kyleheadley

Description

@kyleheadley

Clang (cc1) has a nice -verify option that uses comments in the input files to check that diagnostics (errors, warnings, etc) have occurred as intended. Clang's tools interface allows use of verify as well, but 3C only has it set up for the rewrite phase, and few regression tests make use of it. We should make it available to the full program in preparation for constructing better user interfaces.

To get it to work, we at least need to enable the option in tooling (like here), produce diagnostics (like here), and exit from 3C with success. The diagnostics and lack of output become the failure conditions, rather than an assert crash or stderr message with exit.

The main work for this issue will be to restructure these error cases. After each phase (most likely), 3C will need to check if it is in an error state and exit, the diagnostics having run previously when the error was noticed. Asserts that were intended to end the program with an error message need to be refactored, and we need an alternate way to end the program immediately for any of these that might lead to program corruption. Mike has suggested exceptions as a quick alternative.

Additionally, tests which currently grep for diagnostic messages need to be updated to use -verify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions