Skip to content

Commit feba5dc

Browse files
authored
Merge pull request #571 from diffblue/property-description
Property description now taken from front-end
2 parents 921e331 + 00a34b4 commit feba5dc

File tree

8 files changed

+30
-27
lines changed

8 files changed

+30
-27
lines changed

regression/ebmc/CLI/json-properties.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ json-properties.v
44
activate-multi-line-match
55
\[
66
\{
7-
"description": "",
7+
"description": "always 1 == 2",
88
"location": \{
99
"file": "json-properties\.v",
1010
"line": "3",

src/ebmc/ebmc_properties.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ ebmc_propertiest ebmc_propertiest::from_transition_system(
7373
properties.properties.back().name = symbol.display_name();
7474
properties.properties.back().original_expr = symbol.value;
7575
properties.properties.back().location = symbol.location;
76-
properties.properties.back().expr_string = value_as_string;
7776
properties.properties.back().mode = symbol.mode;
7877
properties.properties.back().description =
7978
id2string(symbol.location.get_comment());
@@ -172,10 +171,9 @@ ebmc_propertiest ebmc_propertiest::from_command_line(
172171
auto &p = properties.properties.back();
173172
p.original_expr = expr;
174173
p.normalized_expr = normalize_property(expr);
175-
p.expr_string = expr_as_string;
176174
p.mode = transition_system.main_symbol->mode;
177175
p.location.make_nil();
178-
p.description = "command-line assertion";
176+
p.description = expr_as_string;
179177
p.name = "command-line assertion";
180178

181179
return properties;

src/ebmc/ebmc_properties.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class ebmc_propertiest
2828
std::size_t number = 0;
2929
irep_idt identifier, name;
3030
source_locationt location;
31-
std::string expr_string;
3231
irep_idt mode;
3332
exprt original_expr;
3433
exprt normalized_expr;

src/ebmc/liveness_to_safety.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void liveness_to_safetyt::operator()()
246246
else
247247
{
248248
throw ebmc_errort().with_location(property.location)
249-
<< "no liveness-to-safety translation for " << property.expr_string;
249+
<< "no liveness-to-safety translation for " << property.description;
250250
}
251251
}
252252
}

src/ebmc/report_results.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void report_results(
9898
if(property.is_disabled())
9999
continue;
100100

101-
message.status() << "[" << property.name << "] " << property.expr_string
101+
message.status() << "[" << property.name << "] " << property.description
102102
<< ": ";
103103

104104
using statust = ebmc_propertiest::propertyt::statust;

src/ebmc/show_properties.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,37 @@ void ebmc_baset::show_properties()
3333
{
3434
unsigned p_nr=1;
3535

36+
auto make_xml =
37+
[](const ebmc_propertiest::propertyt &p, std::size_t p_nr) -> xmlt {
38+
xmlt xml("property");
39+
xml.set_attribute("name", id2string(p.name));
40+
41+
xml.new_element("number").data = std::to_string(p_nr); // will go away
42+
xml.new_element("description").data = p.description;
43+
44+
if(p.location.is_not_nil())
45+
xml.new_element("location") = ::xml(p.location);
46+
47+
return xml;
48+
};
49+
3650
for(const auto &p : properties.properties)
3751
{
38-
switch (static_cast<ui_message_handlert &>(message.get_message_handler()).get_ui()) {
52+
switch(static_cast<ui_message_handlert &>(message.get_message_handler())
53+
.get_ui())
54+
{
3955
case ui_message_handlert::uit::XML_UI:
40-
{
41-
xmlt xml("property");
42-
xml.set_attribute("name", id2string(p.name));
43-
44-
xml.new_element("number").data=std::to_string(p_nr); // will go away
45-
xml.new_element("expression").data=p.expr_string;
46-
xml.new_element("description").data=p.description;
47-
48-
if(p.location.is_not_nil())
49-
xml.new_element("location")=::xml(p.location);
50-
51-
std::cout << xml << '\n';
52-
}
56+
std::cout << make_xml(p, p_nr) << '\n';
5357
break;
5458

5559
case ui_message_handlert::uit::PLAIN:
56-
std::cout << p.name << ": ";
57-
std::cout << p.expr_string;
58-
if(!p.description.empty())
59-
std::cout << " (" << p.description << ")";
60-
std::cout << '\n';
60+
std::cout << p.name << ": " << p.description << '\n';
6161
break;
62+
6263
case ui_message_handlert::uit::JSON_UI:
6364
default:;
6465
}
65-
66+
6667
p_nr++;
6768
}
6869
}

src/smvlang/smv_typecheck.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,7 @@ void smv_typecheckt::convert(smv_parse_treet::modulet &smv_module)
14911491
spec_symbol.mode = "SMV";
14921492
spec_symbol.value = it->expr;
14931493
spec_symbol.location = it->location;
1494+
spec_symbol.location.set_comment(to_string(it->expr));
14941495

14951496
if(smv_module.name == "smv::main")
14961497
spec_symbol.pretty_name = spec_symbol.base_name;

src/verilog/verilog_synthesis.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,8 @@ void verilog_synthesist::synth_assert_assume_cover(
23232323
cond = sva_cover_exprt(cond);
23242324
}
23252325

2326+
symbol.location.set_comment(to_string(cond));
2327+
23262328
symbol.value = std::move(cond);
23272329
}
23282330

@@ -2374,6 +2376,8 @@ void verilog_synthesist::synth_assert_assume_cover(
23742376
else
23752377
PRECONDITION(false);
23762378

2379+
symbol.location.set_comment(to_string(cond));
2380+
23772381
symbol.value = std::move(cond);
23782382
}
23792383

0 commit comments

Comments
 (0)