Skip to content

Introduce fieldref_exprt to represent a field reference #1856

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 2 commits into from
Feb 23, 2018
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
17 changes: 17 additions & 0 deletions src/java_bytecode/java_bytecode_parse_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,21 @@ class java_bytecode_parse_treet
}
};

/// Represents the argument of an instruction that uses a CONSTANT_Fieldref
/// This is used for example as an argument to a getstatic and putstatic
/// instruction
class fieldref_exprt : public exprt
{
public:
fieldref_exprt(
const typet &type,
const irep_idt &component_name,
const irep_idt &class_name)
: exprt(ID_empty_string, type)
{
set(ID_class, class_name);
set(ID_component_name, component_name);
}
};

#endif // CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_PARSE_TREE_H
5 changes: 2 additions & 3 deletions src/java_bytecode/java_bytecode_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,8 @@ void java_bytecode_parsert::rconstant_pool()
symbol_typet class_symbol=
java_classname(id2string(class_name_entry.s));

exprt fieldref("fieldref", type);
fieldref.set(ID_class, class_symbol.get_identifier());
fieldref.set(ID_component_name, name_entry.s);
fieldref_exprt fieldref(
type, name_entry.s, class_symbol.get_identifier());

it->expr=fieldref;
}
Expand Down