Skip to content

Replace CProver_Assert with Assert Statment; Adds Property Class#1002

Merged
jaisnan merged 28 commits intomodel-checking:mainfrom
jaisnan:Jaisnan-Issue-907
Apr 6, 2022
Merged

Replace CProver_Assert with Assert Statment; Adds Property Class#1002
jaisnan merged 28 commits intomodel-checking:mainfrom
jaisnan:Jaisnan-Issue-907

Conversation

@jaisnan
Copy link
Contributor

@jaisnan jaisnan commented Mar 31, 2022

Description of changes:

  1. Replaces old CProver_assert function calls with Assert Statements.
  2. Adds new Location variant for cases where no location is detailed but property class is needed (subject to review).
  3. Replaces assert_false function body with new assert_statement

Resolved issues:

Resolves #907

Call-outs:

This change potentially has far reaching consequences for the UI and could have some unintended consequences. Existing tests don't quite cover it.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@jaisnan jaisnan requested a review from a team as a code owner March 31, 2022 16:42
Stmt::assert(expect_true.clone(), &assert_msg, loc.clone()),
Stmt::assert_statement(
expect_true.clone(),
"sanity_check",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be hard-coded?

Copy link
Contributor Author

@jaisnan jaisnan Mar 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't come up with a better solution tbh. Open to suggestions about how to address property_class values in cprover_bindings. Maybe I can use the PropertyClass Enum values from codegen here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries... I think we discussed that before, didn't we? Sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agreed to separate the enum from cprover_bindings and place it in codegen, but beyond that i dont think we discussed about calling the enum from codegen again in cprover_bindings. I can do that but i feel like it would remove the seperation of logic, which is why i just hardcoded the string.

open to any suggestions regarding this.

AssertFalse,
Assume,
DefaultAssertion,
CustomProperty(String),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be InternedString

Copy link
Contributor Author

@jaisnan jaisnan Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think so, will change it to use that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to update this but we don't use InternedString on the codegen side of things so I just left it as String for now.

@jaisnan jaisnan requested a review from zhassan-aws April 5, 2022 15:00
Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments, but overall looks good!

We probably need to classify some of the checks using their own property class, e.g. non-null virtual function, unreachable code, etc., but we can do that in later PRs.

@jaisnan jaisnan merged commit e86cb64 into model-checking:main Apr 6, 2022
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
tedinski pushed a commit that referenced this pull request Apr 27, 2022
* Replace cprover_Asserts

* Add Tests for Property Classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace CPROVER_Assert function calls with new Assert Stmt

4 participants