Skip to content

protect typet::subtype() const #7097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 4, 2022
Merged

protect typet::subtype() const #7097

merged 2 commits into from
Sep 4, 2022

Conversation

kroening
Copy link
Member

@kroening kroening commented Sep 4, 2022

Long-term readers of this sequence of PRs will be pleased to note that this is the final one for the const variant.

The non-const variant is to follow.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

This commit replaces uses of typet::subtype() const by casting the type to
the applicable subtype, and then using the appropriate accessor method.
Protecting this method enables the use of type-specific accessor methods,
which can exploit type invariants about the existence of the subtype.
@codecov
Copy link

codecov bot commented Sep 4, 2022

Codecov Report

Merging #7097 (4067de6) into develop (381b34d) will increase coverage by 0.01%.
The diff coverage is 87.29%.

@@             Coverage Diff             @@
##           develop    #7097      +/-   ##
===========================================
+ Coverage    77.85%   77.87%   +0.01%     
===========================================
  Files         1574     1576       +2     
  Lines       181245   181568     +323     
===========================================
+ Hits        141109   141394     +285     
- Misses       40136    40174      +38     
Impacted Files Coverage Δ
...-sensitivity/value_set_pointer_abstract_object.cpp 88.72% <0.00%> (ø)
..._incremental/smt2_incremental_decision_procedure.h 75.00% <ø> (ø)
src/solvers/smt2_incremental/smt_solver_process.h 100.00% <ø> (ø)
src/util/type.h 98.59% <ø> (-1.41%) ⬇️
src/goto-instrument/contracts/inlining_decorator.h 34.78% <34.78%> (ø)
src/pointer-analysis/value_set_fi.cpp 69.15% <35.71%> (-0.30%) ⬇️
...c/goto-instrument/contracts/inlining_decorator.cpp 62.29% <62.29%> (ø)
src/cpp/cpp_typecheck_resolve.cpp 70.00% <62.50%> (-0.13%) ⬇️
jbmc/unit/java-testing-utils/require_type.cpp 92.18% <75.00%> (ø)
src/cpp/cpp_typecheck_expr.cpp 71.76% <77.77%> (ø)
... and 27 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@kroening kroening marked this pull request as ready for review September 4, 2022 20:23
@kroening kroening merged commit 7743751 into develop Sep 4, 2022
@kroening kroening deleted the typet_subtype_const4 branch September 4, 2022 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants