|
11 | 11 |
|
12 | 12 | #include "all_properties_class.h"
|
13 | 13 |
|
| 14 | +#include <algorithm> |
14 | 15 | #include <chrono>
|
15 | 16 |
|
16 | 17 | #include <util/xml.h>
|
@@ -158,17 +159,63 @@ void bmc_all_propertiest::report(const cover_goalst &cover_goals)
|
158 | 159 | {
|
159 | 160 | result() << "\n** Results:" << eom;
|
160 | 161 |
|
161 |
| - for(const auto &goal_pair : goal_map) |
| 162 | + // collect goals in a vector |
| 163 | + std::vector<goal_mapt::const_iterator> goals; |
| 164 | + |
| 165 | + for(auto g_it = goal_map.begin(); g_it != goal_map.end(); g_it++) |
| 166 | + goals.push_back(g_it); |
| 167 | + |
| 168 | + // now determine an ordering for those goals: |
| 169 | + // 1. alphabetical ordering of file name |
| 170 | + // 2. numerical ordering of line number |
| 171 | + // 3. alphabetical ordering of goal ID |
| 172 | + std::sort( |
| 173 | + goals.begin(), |
| 174 | + goals.end(), |
| 175 | + [](goal_mapt::const_iterator git1, goal_mapt::const_iterator git2) { |
| 176 | + const auto &g1 = git1->second.source_location; |
| 177 | + const auto &g2 = git2->second.source_location; |
| 178 | + if(g1.get_file() != g2.get_file()) |
| 179 | + return id2string(g1.get_file()) < id2string(g2.get_file()); |
| 180 | + else if(!g1.get_line().empty() && !g2.get_line().empty()) |
| 181 | + return std::stoul(id2string(g1.get_line())) < |
| 182 | + std::stoul(id2string(g2.get_line())); |
| 183 | + else |
| 184 | + return id2string(git1->first) < id2string(git2->first); |
| 185 | + }); |
| 186 | + |
| 187 | + // now show in the order we have determined |
| 188 | + |
| 189 | + irep_idt previous_function; |
| 190 | + for(const auto &g : goals) |
162 | 191 | {
|
163 |
| - result() << "[" << goal_pair.first << "] " |
164 |
| - << goal_pair.second.description << ": "; |
| 192 | + const auto &l = g->second.source_location; |
165 | 193 |
|
166 |
| - if(goal_pair.second.status == goalt::statust::SUCCESS) |
| 194 | + if(l.get_function() != previous_function) |
| 195 | + { |
| 196 | + if(!previous_function.empty()) |
| 197 | + result() << '\n'; |
| 198 | + previous_function = l.get_function(); |
| 199 | + if(!previous_function.empty()) |
| 200 | + { |
| 201 | + if(!l.get_file().empty()) |
| 202 | + result() << l.get_file() << ' '; |
| 203 | + if(!l.get_function().empty()) |
| 204 | + result() << "function " << l.get_function(); |
| 205 | + result() << eom; |
| 206 | + } |
| 207 | + } |
| 208 | + |
| 209 | + result() << faint << '[' << g->first << "] " << reset; |
| 210 | + |
| 211 | + result() << g->second.description << ": "; |
| 212 | + |
| 213 | + if(g->second.status == goalt::statust::SUCCESS) |
167 | 214 | result() << green;
|
168 | 215 | else
|
169 | 216 | result() << red;
|
170 | 217 |
|
171 |
| - result() << goal_pair.second.status_string() << reset << eom; |
| 218 | + result() << g->second.status_string() << reset << eom; |
172 | 219 | }
|
173 | 220 |
|
174 | 221 | if(bmc.options.get_bool_option("trace"))
|
|
0 commit comments