Skip to content

cpp_scopet::lookup methods now return an id set #3063

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
Sep 29, 2018
Merged

Conversation

kroening
Copy link
Member

  • Each commit message has a non-empty body, explaining why the change was made.
  • My contribution is formatted in line with CODING_STANDARD.md.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • 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).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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: bfe7eed).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86364498

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

I may be wrong on some of the below, but it looks like a lot of const-ness could be added.

@@ -335,8 +335,8 @@ const symbolt &cpp_typecheckt::instantiate_template(
{
cpp_scopet &scope=cpp_scopes.get_scope(subscope_name);

cpp_scopet::id_sett id_set;
scope.lookup(template_symbol.base_name, cpp_scopet::SCOPE_ONLY, id_set);
cpp_scopet::id_sett id_set =
Copy link
Collaborator

Choose a reason for hiding this comment

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

const


cpp_typecheck.cpp_scopes.current_scope().lookup(
base_name, cpp_scopet::SCOPE_ONLY, id_set);
cpp_scopest::id_sett id_set =
Copy link
Collaborator

Choose a reason for hiding this comment

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

const


scope->lookup_identifier(
symbol.name, cpp_idt::id_classt::TEMPLATE_PARAMETER, id_set);
cpp_scopet::id_sett id_set = scope->lookup_identifier(
Copy link
Collaborator

Choose a reason for hiding this comment

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

const

bool cpp_scopet::contains(const irep_idt &base_name)
{
id_sett id_set;
lookup(base_name, SCOPE_ONLY, id_set);
const id_sett id_set = lookup(base_name, SCOPE_ONLY);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this should just be rewritten as return !lookup(base_name, SCOPE_ONLY).empty();

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

@@ -105,8 +105,8 @@ cpp_scopet &cpp_typecheckt::tag_scope(
// Check if we have it already. If so, take it.

// we should only look for tags, but we don't
cpp_scopet::id_sett id_set;
cpp_scopes.current_scope().lookup(base_name, cpp_scopet::RECURSIVE, id_set);
cpp_scopet::id_sett id_set =
Copy link
Collaborator

Choose a reason for hiding this comment

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

const

cpp_scopet::SCOPE_ONLY,
cpp_scopet::TEMPLATE,
id_set);
cpp_scopet::id_sett id_set=
Copy link
Collaborator

Choose a reason for hiding this comment

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

const

cpp_scopet::id_sett id_set;

cpp_scopes.current_scope().lookup(
cpp_scopet::id_sett id_set = cpp_scopes.current_scope().lookup(
Copy link
Collaborator

Choose a reason for hiding this comment

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

const

cpp_scopest::id_sett id_set;
cpp_scopes.current_scope().lookup(
base_name, cpp_scopet::SCOPE_ONLY, cpp_idt::id_classt::TEMPLATE, id_set);
cpp_scopest::id_sett id_set = cpp_scopes.current_scope().lookup(
Copy link
Collaborator

Choose a reason for hiding this comment

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

const

cpp_scopest::id_sett id_set;
cpp_scopes.current_scope().lookup(
base_name, cpp_scopet::SCOPE_ONLY, id_set);
cpp_scopest::id_sett id_set =
Copy link
Collaborator

Choose a reason for hiding this comment

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

const


cpp_scopes.current_scope().lookup(
base_name, qualified?cpp_scopet::QUALIFIED:cpp_scopet::RECURSIVE, id_set);
cpp_scopest::id_sett id_set = cpp_scopes.current_scope().lookup(
Copy link
Collaborator

Choose a reason for hiding this comment

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

const

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: 89b2bb3).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86369058

@kroening kroening merged commit 63bf323 into develop Sep 29, 2018
@kroening kroening deleted the cpp_scopet_lookup branch September 29, 2018 17:43
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.

3 participants