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

Make componentt::{base,pretty}_name comments #5815

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified regression/ansi-c/arch_flags_mcpu_bad/object.intel
Binary file not shown.
Binary file modified regression/ansi-c/arch_flags_mcpu_good/object.arm
Binary file not shown.
Binary file modified regression/ansi-c/arch_flags_mthumb_bad/object.intel
Binary file not shown.
Binary file modified regression/ansi-c/arch_flags_mthumb_good/object.arm
Binary file not shown.
13 changes: 8 additions & 5 deletions src/ansi-c/expr2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1564,13 +1564,13 @@ std::string expr2ct::convert_member(

if(!component_name.empty())
{
const exprt &comp_expr = struct_union_type.get_component(component_name);
const auto &comp_expr = struct_union_type.get_component(component_name);

if(comp_expr.is_nil())
return convert_norep(src, precedence);

if(!comp_expr.get(ID_pretty_name).empty())
dest+=comp_expr.get_string(ID_pretty_name);
if(!comp_expr.get_pretty_name().empty())
dest += id2string(comp_expr.get_pretty_name());
else
dest+=id2string(component_name);

Expand All @@ -1582,9 +1582,12 @@ std::string expr2ct::convert_member(
if(n>=struct_union_type.components().size())
return convert_norep(src, precedence);

const exprt &comp_expr = struct_union_type.components()[n];
const auto &comp_expr = struct_union_type.components()[n];

dest+=comp_expr.get_string(ID_pretty_name);
if(!comp_expr.get_pretty_name().empty())
dest += id2string(comp_expr.get_pretty_name());
else
dest += id2string(comp_expr.get_name());

return dest;
}
Expand Down
5 changes: 4 additions & 1 deletion src/cpp/expr2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ std::string expr2cppt::convert_struct(

dest+=sep;
dest+='.';
dest += c.get_string(ID_pretty_name);
if(!c.get_pretty_name().empty())
dest += id2string(c.get_pretty_name());
else
dest += id2string(c.get_name());
dest+='=';
dest+=tmp;
}
Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/alignment_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void print_struct_alignment_problems(
<< symbol_pair.second.location << '\n';
}

out << "members " << it_mem->get_pretty_name() << " and "
<< it_next->get_pretty_name() << " might interfere\n";
out << "members " << it_mem->get_name() << " and "
<< it_next->get_name() << " might interfere\n";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/write_goto_binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Author: CM Wintersteiger
#ifndef CPROVER_GOTO_PROGRAMS_WRITE_GOTO_BINARY_H
#define CPROVER_GOTO_PROGRAMS_WRITE_GOTO_BINARY_H

#define GOTO_BINARY_VERSION 5
#define GOTO_BINARY_VERSION 6
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need a major or minor version number bump?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know how many customers have use cases where they build goto binaries, store them, and (re-)analyse them at a later point in time. I know that's something I occasionally see, but I have no idea how common this is. So I'm with you that a version number change is desirable, but I'd lean towards minor-version-bump-is-sufficient. If others agree with this, then we could contemplate merging this PR just before one of the next regular version bumps (e.g., next Thursday).


#include <iosfwd>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/util/irep_ids.def
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ IREP_ID_TWO(mult, *)
IREP_ID_TWO(div, /)
IREP_ID_TWO(power, **)
IREP_ID_ONE(factorial_power)
IREP_ID_ONE(pretty_name)
IREP_ID_TWO(C_pretty_name, #pretty_name)
IREP_ID_TWO(C_class, #class)
IREP_ID_TWO(C_field, #field)
IREP_ID_TWO(C_interface, #interface)
Expand Down
8 changes: 4 additions & 4 deletions src/util/std_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ class struct_union_typet:public typet

const irep_idt &get_base_name() const
{
return get(ID_base_name);
return get(ID_C_base_name);
}

void set_base_name(const irep_idt &base_name)
{
return set(ID_base_name, base_name);
return set(ID_C_base_name, base_name);
}

const irep_idt &get_access() const
Expand All @@ -108,12 +108,12 @@ class struct_union_typet:public typet

const irep_idt &get_pretty_name() const
{
return get(ID_pretty_name);
return get(ID_C_pretty_name);
}

void set_pretty_name(const irep_idt &name)
{
return set(ID_pretty_name, name);
return set(ID_C_pretty_name, name);
}

bool get_anonymous() const
Expand Down