Skip to content

remove typet::subtype() #7561

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 1 commit into from
Feb 24, 2023
Merged

remove typet::subtype() #7561

merged 1 commit into from
Feb 24, 2023

Conversation

kroening
Copy link
Member

This adds specialised variants of typet::subtype() to the three inheriting classes that use the method. These cannot use type_with_subtypet since C++ doesn't have mixins. The plan is to remove these methods in favor of the existing type-specific accessor methods.

After that, typet::subtype() can be removed.

  • Each commit message has a non-empty body, explaining why the change was made.
  • 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.

@tautschnig tautschnig assigned kroening and unassigned tautschnig Feb 23, 2023
@kroening kroening force-pushed the remove_typet_subtype branch from 54a89ab to 0f8ccde Compare February 23, 2023 13:51
@kroening kroening marked this pull request as ready for review February 23, 2023 14:06
@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Base: 78.43% // Head: 78.49% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (907e28f) compared to base (d7099ae).
Patch coverage: 71.42% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7561      +/-   ##
===========================================
+ Coverage    78.43%   78.49%   +0.06%     
===========================================
  Files         1670     1670              
  Lines       191671   191678       +7     
===========================================
+ Hits        150331   150464     +133     
+ Misses       41340    41214     -126     
Impacted Files Coverage Δ
src/cpp/cpp_template_type.h 39.13% <0.00%> (-13.82%) ⬇️
src/util/type.h 100.00% <ø> (+9.21%) ⬆️
src/util/c_types.h 100.00% <100.00%> (ø)
src/util/pointer_expr.h 96.75% <100.00%> (+0.02%) ⬆️
src/util/bitvector_expr.h 97.41% <0.00%> (+0.46%) ⬆️
src/util/symbol_table.cpp 91.30% <0.00%> (+2.17%) ⬆️
src/util/validate_helpers.h 100.00% <0.00%> (+11.11%) ⬆️
src/big-int/bigint.cc 89.00% <0.00%> (+14.26%) ⬆️
... and 3 more

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@thomasspriggs thomasspriggs left a comment

Choose a reason for hiding this comment

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

I think the missing call to bitvector_typet::check should ideally be fixed before this is merged.

You mention that a lack of mixins prevents usage of type_with_subtypet, which presumably results in the need to write duplicate definitions of the subtype() member functions. I think the Curiously Recurring Template Pattern (CRTP) could be used add in subtype() member functions to the classes in the hierarchy which still require them instead. However that would be a different refactor which I do not think should hold up this PR.

const typet &type,
const validation_modet vm = validation_modet::INVARIANT)
{
type_with_subtypet::check(type, vm);
Copy link
Contributor

Choose a reason for hiding this comment

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

This function should include a call to bitvector_typet::check as well, because the new function hides the existing one.

This adds specialised variants of typet::subtype() to the three inheriting
classes that use the method.  These cannot use type_with_subtypet since C++
doesn't have mixins.  The plan is to remove these methods in favor of the
existing type-specific accessor methods.

After that, typet::subtype() can be removed.
@kroening kroening force-pushed the remove_typet_subtype branch from 0f8ccde to 907e28f Compare February 23, 2023 15:42
@kroening kroening merged commit 3fe510e into develop Feb 24, 2023
@kroening kroening deleted the remove_typet_subtype branch February 24, 2023 07:40
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.

4 participants