Skip to content

Commit 2afb1a4

Browse files
authored
Merge pull request diffblue#233 from diffblue/feature/added_listing_of_function_without_bodies_to_HTML_program_dump
Listing of functions without bodies to HTML program dump.
2 parents cf62e25 + e115cef commit 2afb1a4

File tree

1 file changed

+95
-38
lines changed

1 file changed

+95
-38
lines changed

src/summaries/summary_dump.cpp

Lines changed: 95 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,16 @@ std::string dump_symbol_table_symbols_in_html(
431431

432432
dump_html_prefix(ostr, "Symbol table symbols");
433433
ostr << "<h2>Symbols table</h2>\n";
434-
ostr << "<table>\n"
435-
" <tr>\n"
436-
" <th>Symbol name</th>\n"
437-
" <th>Properties</th>\n"
438-
" </tr>\n";
439434
std::map<std::string, irep_idt> sorted_keys;
440435
for(const auto &name_props : symbol_table.symbols)
441436
sorted_keys.insert({to_html_text(as_string(name_props.first)),
442437
name_props.first});
438+
ostr << "<table>\n"
439+
" <caption>There are " << sorted_keys.size() << " symbols.</caption>\n"
440+
" <tr>\n"
441+
" <th>Symbol name</th>\n"
442+
" <th>Properties</th>\n"
443+
" </tr>\n";
443444
for(const auto &name_key : sorted_keys)
444445
{
445446
const symbolt &symbol=symbol_table.symbols.at(name_key.second);
@@ -684,25 +685,29 @@ std::string dump_symbol_table_as_html_table(
684685
if(!error.empty())
685686
return error;
686687

687-
ostr << "<table>\n"
688-
" <tr>\n"
689-
" <th>Property</th>\n"
690-
" <th>Value</th>\n"
691-
" </tr>\n"
692-
" <tr>\n"
693-
" <td>Detailed information about all symbols in the table</td>\n"
694-
" <td><a href=\"./symbol_table_symbols.html\">here</a></td>\n"
695-
" </tr>\n"
696-
" <tr>\n"
697-
" <td>Content of multimap 'symbol_tablet::symbol_base_map'</td>\n"
698-
" <td><a href=\"./symbol_table_base.html\">here</a></td>\n"
699-
" </tr>\n"
700-
" <tr>\n"
701-
" <td>Content of multimap 'symbol_tablet::symbol_module_map'"
702-
"</td>\n"
703-
" <td><a href=\"./symbol_table_module.html\">here</a></td>\n"
704-
" </tr>\n"
705-
"</table>\n";
688+
ostr
689+
<< "<table>\n"
690+
<< " <caption>There are "
691+
<< symbol_table.symbols.size()
692+
<< " symbols.</caption>\n"
693+
<< " <tr>\n"
694+
<< " <th>Property</th>\n"
695+
<< " <th>Value</th>\n"
696+
<< " </tr>\n"
697+
<< " <tr>\n"
698+
<< " <td>Detailed information about all symbols in the table</td>\n"
699+
<< " <td><a href=\"./symbol_table_symbols.html\">here</a></td>\n"
700+
<< " </tr>\n"
701+
<< " <tr>\n"
702+
<< " <td>Content of multimap 'symbol_tablet::symbol_base_map'</td>\n"
703+
<< " <td><a href=\"./symbol_table_base.html\">here</a></td>\n"
704+
<< " </tr>\n"
705+
<< " <tr>\n"
706+
<< " <td>Content of multimap 'symbol_tablet::symbol_module_map'"
707+
<< "</td>\n"
708+
<< " <td><a href=\"./symbol_table_module.html\">here</a></td>\n"
709+
<< " </tr>\n"
710+
<< "</table>\n";
706711

707712
return error;
708713
}
@@ -769,16 +774,21 @@ std::string dump_goto_program_in_html(
769774
ostr << "<h1>Properties of the analysed GOTO program</h1>\n";
770775

771776
ostr << "<h3>Listing of functions with bodies (definitions).</h3>\n";
772-
ostr << "<table>\n"
773-
" <tr>\n"
774-
" <th>Function name</th>\n"
775-
" <th>Code</th>\n"
776-
" </tr>\n"
777-
;
778-
std::set<std::string> ordered;
777+
std::set<std::string> ordered, ordered_declarations;
779778
for(auto it = functions.cbegin(); it != functions.cend(); it++)
779+
{
780780
if(it->second.body_available())
781781
ordered.insert(as_string(it->first));
782+
else
783+
ordered_declarations.insert(as_string(it->first));
784+
}
785+
ostr
786+
<< "<table>\n"
787+
<< " <caption>There are " << ordered.size() << " functions.</caption>\n"
788+
<< " <tr>\n"
789+
<< " <th>Function name</th>\n"
790+
<< " <th>Code</th>\n"
791+
<< " </tr>\n";
782792
for (auto const& fn_name : ordered)
783793
ostr << " <tr>\n"
784794
" <td>" << to_html_text(fn_name) << "</td>\n"
@@ -788,6 +798,25 @@ std::string dump_goto_program_in_html(
788798
;
789799
ostr << "</table>\n";
790800

801+
if(!ordered_declarations.empty())
802+
{
803+
ostr
804+
<< "<h3>Listing of functions without bodies (undefined references)</h3>\n"
805+
<< "<table>\n"
806+
<< " <caption>There are "
807+
<< ordered_declarations.size()
808+
<< " functions.";
809+
for(const auto &fn_name : ordered_declarations)
810+
{
811+
ostr
812+
<< " <tr>\n"
813+
<< " <td>" << to_html_text(fn_name) << "</td>\n"
814+
<< " </tr>\n";
815+
}
816+
ostr << "</table>\n";
817+
}
818+
819+
791820
ostr << "<h3>Symbol table</h3>\n";
792821

793822
std::string error=
@@ -895,23 +924,51 @@ std::string dump_goto_functions_in_html(
895924
"Cannot open the log file '" << log_filename
896925
<< "'.";
897926
dump_html_prefix(ostr, "Functions");
898-
ostr << "<h3>Listing of functions</h3>\n";
899-
ostr << "<table>\n"
900-
" <tr>\n"
901-
" <th>Function name</th>\n"
902-
" <th>Code</th>\n"
903-
" </tr>\n";
904-
std::set<std::string> ordered;
927+
ostr << "<h3>Listing of functions with bodies (definitions)</h3>\n";
928+
std::set<std::string> ordered, ordered_declarations;
905929
for(auto it=functions.cbegin(); it!=functions.cend(); ++it)
930+
{
906931
if(it->second.body_available())
907932
ordered.insert(as_string(it->first));
933+
else
934+
ordered_declarations.insert(as_string(it->first));
935+
}
936+
ostr
937+
<< "<table>\n"
938+
<< " <caption>There are "
939+
<< ordered.size()
940+
<< " functions."
941+
<<"</caption>\n"
942+
<< " <tr>\n"
943+
<< " <th>Function name</th>\n"
944+
<< " <th>Code</th>\n"
945+
<< " </tr>\n";
908946
for(const auto &fn_name : ordered)
909947
ostr << " <tr>\n"
910948
" <td>" << to_html_text(fn_name) << "</td>\n"
911949
" <td><a href=\"./" << to_file_name(fn_name)
912950
<< "/index.html\">here</a></td>\n"
913951
" </tr>\n";
914952
ostr << "</table>\n";
953+
954+
if(!ordered_declarations.empty())
955+
{
956+
ostr
957+
<< "<h3>Listing of functions without bodies (undefined references)</h3>\n"
958+
<< "<table>\n"
959+
<< " <caption>There are "
960+
<< ordered_declarations.size()
961+
<< " functions.";
962+
for(const auto &fn_name : ordered_declarations)
963+
{
964+
ostr
965+
<< " <tr>\n"
966+
<< " <td>" << to_html_text(fn_name) << "</td>\n"
967+
<< " </tr>\n";
968+
}
969+
ostr << "</table>\n";
970+
}
971+
915972
dump_html_suffix(ostr);
916973
return ""; // no error.
917974
}

0 commit comments

Comments
 (0)