diff options
author | Martin Liska <mliska@suse.cz> | 2019-10-22 11:58:27 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-10-22 09:58:27 +0000 |
commit | 076222782e4558e0bd22711c6fdcc0faf0882daf (patch) | |
tree | 3cbd3dcafcbcaf3939736dfe771309b5915a6263 /gcc/gcov.c | |
parent | fc25649ccd251d9a6c2e27ac821276caaea986e4 (diff) | |
download | gcc-076222782e4558e0bd22711c6fdcc0faf0882daf.zip gcc-076222782e4558e0bd22711c6fdcc0faf0882daf.tar.gz gcc-076222782e4558e0bd22711c6fdcc0faf0882daf.tar.bz2 |
Come up with json::integer_number and use it in GCOV.
2019-10-22 Martin Liska <mliska@suse.cz>
* diagnostic-format-json.cc (json_from_expanded_location):
Use json::integer_number.
* gcov.c (output_intermediate_json_line): Use new
json::integer_number.
(output_json_intermediate_file): Likewise.
* json.cc (number::print): Move to ...
(float_number::print): ... this.
(integer_number::print): New.
(test_writing_numbers): Move to ...
(test_writing_float_numbers): ... this.
(test_writing_integer_numbers): New.
(json_cc_tests): Register test_writing_integer_numbers.
* json.h (class value): Add forward declaration
for float_number and integer_number.
(enum kind): Add JSON_INTEGER and JSON_FLOAT.
(class number): Move to ...
(class float_number): ... this.
(class integer_number): New.
* optinfo-emit-json.cc (optrecord_json_writer::impl_location_to_json):
Use json::integer_number.
(optrecord_json_writer::location_to_json): Likewise.
(optrecord_json_writer::profile_count_to_json): Likewise.
(optrecord_json_writer::pass_to_json): Likewise.
From-SVN: r277284
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r-- | gcc/gcov.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -1061,10 +1061,10 @@ output_intermediate_json_line (json::array *object, return; json::object *lineo = new json::object (); - lineo->set ("line_number", new json::number (line_num)); + lineo->set ("line_number", new json::integer_number (line_num)); if (function_name != NULL) lineo->set ("function_name", new json::string (function_name)); - lineo->set ("count", new json::number (line->count)); + lineo->set ("count", new json::integer_number (line->count)); lineo->set ("unexecuted_block", new json::literal (line->has_unexecuted_block)); @@ -1079,7 +1079,7 @@ output_intermediate_json_line (json::array *object, if (!(*it)->is_unconditional && !(*it)->is_call_non_return) { json::object *branch = new json::object (); - branch->set ("count", new json::number ((*it)->count)); + branch->set ("count", new json::integer_number ((*it)->count)); branch->set ("throw", new json::literal ((*it)->is_throw)); branch->set ("fallthrough", new json::literal ((*it)->fall_through)); @@ -1138,16 +1138,19 @@ output_json_intermediate_file (json::array *json_files, source_info *src) function->set ("name", new json::string ((*it)->m_name)); function->set ("demangled_name", new json::string ((*it)->get_demangled_name ())); - function->set ("start_line", new json::number ((*it)->start_line)); - function->set ("start_column", new json::number ((*it)->start_column)); - function->set ("end_line", new json::number ((*it)->end_line)); - function->set ("end_column", new json::number ((*it)->end_column)); + function->set ("start_line", + new json::integer_number ((*it)->start_line)); + function->set ("start_column", + new json::integer_number ((*it)->start_column)); + function->set ("end_line", new json::integer_number ((*it)->end_line)); + function->set ("end_column", + new json::integer_number ((*it)->end_column)); function->set ("blocks", - new json::number ((*it)->get_block_count ())); + new json::integer_number ((*it)->get_block_count ())); function->set ("blocks_executed", - new json::number ((*it)->blocks_executed)); + new json::integer_number ((*it)->blocks_executed)); function->set ("execution_count", - new json::number ((*it)->blocks[0].count)); + new json::integer_number ((*it)->blocks[0].count)); functions->append (function); } |