Skip to content

C++ destructors: Ensure "this" is a fully qualified name #4471

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

Conversation

tautschnig
Copy link
Collaborator

Typechecking does not magically expand ID_this, and there isn't sufficient context to use "cpp-this."

Fixes: #661

Only the second commit is new, the first commit is #4470.

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

@tautschnig tautschnig force-pushed the c++-temporary-and-destructor branch from 446d656 to bdbfa49 Compare April 1, 2019 17:58
@tautschnig tautschnig changed the title C++ destructors: Ensure "this" is a fully qualified name [depends-on: #4470] C++ destructors: Ensure "this" is a fully qualified name Apr 1, 2019
@tautschnig
Copy link
Collaborator Author

@kroening @peterschrammel Rebased and ready for review

@tautschnig tautschnig force-pushed the c++-temporary-and-destructor branch from bdbfa49 to c1df4ee Compare April 1, 2019 18:32
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: c1df4ee).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106625148

Typechecking does not magically expand `ID_this`, and there isn't
sufficient context to use "cpp-this."

Fixes: diffblue#661
@tautschnig tautschnig force-pushed the c++-temporary-and-destructor branch from f3fd618 to 90d5651 Compare April 8, 2019 09:34
@tautschnig
Copy link
Collaborator Author

@kroening @peterschrammel This should now be ready for a review.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 90d5651).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107448314
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

@@ -171,8 +172,7 @@ irep_idt cpp_typecheckt::function_identifier(const typet &type)
code_typet::parameterst::const_iterator it=
parameters.begin();

if(it!=parameters.end() &&
it->get_identifier()==ID_this)
if(it != parameters.end() && it->get_base_name() == ID_this)
Copy link
Member

Choose a reason for hiding this comment

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

Use get_this()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, everywhere, in a separate commit.

@kroening kroening assigned tautschnig and unassigned kroening and peterschrammel Apr 8, 2019
The "this" parameter must carry a unique name for each class and must be
stored in the symbol table. And indeed make sure that all parameters are
in the symbol table, unless the method a member of a class template and
is never used, in which case the method symbol must be removed.
Previously we mostly did this removal, but would fail for methods with a
body not involving any symbols (as we tested for the existence of some
cpp_name).
Use the method provided by the parametert API rather than the low-level
approach of a fixed base name.
@tautschnig tautschnig force-pushed the c++-temporary-and-destructor branch from 90d5651 to b18138c Compare April 8, 2019 13:20
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: b18138c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107471346
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

@tautschnig tautschnig merged commit 4bf05c8 into diffblue:develop Apr 8, 2019
@tautschnig tautschnig deleted the c++-temporary-and-destructor branch April 8, 2019 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++ Support For Operator Overloading
4 participants