Skip to content
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

string_constantt typing #7965

Merged
merged 2 commits into from
Nov 2, 2023
Merged

string_constantt typing #7965

merged 2 commits into from
Nov 2, 2023

Conversation

kroening
Copy link
Member

  • 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.

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (7f4570b) 78.87% compared to head (cc0d810) 78.74%.
Report is 7 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7965      +/-   ##
===========================================
- Coverage    78.87%   78.74%   -0.13%     
===========================================
  Files         1701     1701              
  Lines       196386   196396      +10     
===========================================
- Hits        154893   154647     -246     
- Misses       41493    41749     +256     
Files Coverage Δ
src/util/string_constant.h 100.00% <100.00%> (ø)
src/util/string_constant.cpp 64.51% <42.85%> (-35.49%) ⬇️

... and 40 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -11,19 +11,37 @@ Author: Daniel Kroening, [email protected]

#include "std_expr.h"

class string_constantt : public nullary_exprt
class string_constantt : public constant_exprt
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is weird: we have a constant_exprt per the C++ type system, but it won’t have ID_constant in the irept type hierarchy. I’m not yet convinced this is the right thing to do.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, going back to nullary_exprt

src/util/string_constant.h Outdated Show resolved Hide resolved
{
public:
explicit string_constantt(const irep_idt &value);
Copy link
Collaborator

@thomasspriggs thomasspriggs Oct 18, 2023

Choose a reason for hiding this comment

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

I know that the value identifier isn't required here, but I'd prefer that we either keep it or explicitly document what this parameter is used for in the header file.

src/util/string_constant.h Show resolved Hide resolved
1) The string_constantt class is expected to maintain the invariant that its
type is an array type.  This is now made explicit by changing the type of
string_constantt::type().

2) A convenience helper to obtain the character type of the string is added.
This adds C++ style (as opposed to Java style) accessors to
string_constantt.
@kroening kroening force-pushed the string-constant-types branch from 758913c to cc0d810 Compare October 31, 2023 10:44
@@ -12,25 +12,40 @@ Author: Daniel Kroening, [email protected]
#include "c_types.h"
#include "std_expr.h"

static array_typet make_type(const irep_idt &value)
{
exprt size_expr = from_integer(value.size() + 1, c_index_type());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am quite confused by the Codecov warnings here: isn't this code path necessarily hit if we ever construct a string_constantt for there is just one constructor? That would suggest that none of our tests ever result in constructing a string_constantt?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems more likely that the coverage job isn't working correctly. There are a couple of things I can think of to try -

@kroening kroening merged commit 03c3c95 into develop Nov 2, 2023
35 of 37 checks passed
@kroening kroening deleted the string-constant-types branch November 2, 2023 00:09
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.

3 participants