From 4a122fd0f24c2019efddad4ae9af322cad41d6e8 Mon Sep 17 00:00:00 2001 From: Pieter Kapsenberg Date: Mon, 20 Jan 2020 11:08:13 -0800 Subject: [PATCH] Add detailed location to XML output (#2122) * Add detailed location to XML output * Fixing build failures * less cryptic regulary expressions * correcting typo in test * Adding file letter to the location attribute, and cleaning up the regular expression in the tests. * Add remaining test expected output files for XML changes * spacing fix, adding documentation on changes --- Changes | 2 + bin/verilator | 5 ++ src/V3EmitXml.cpp | 1 + src/V3FileLine.cpp | 9 ++ src/V3FileLine.h | 1 + test_regress/t/t_clk_concat.pl | 6 +- test_regress/t/t_clk_concat_vlt.pl | 8 +- test_regress/t/t_dedupe_clk_gate.pl | 2 +- test_regress/t/t_dpi_var.pl | 8 +- test_regress/t/t_dpi_var_vlt.pl | 8 +- test_regress/t/t_func_dotted_inl0.pl | 8 +- test_regress/t/t_func_dotted_inl0_vlt.pl | 8 +- test_regress/t/t_func_dotted_inl2.pl | 4 +- test_regress/t/t_func_dotted_inl2_vlt.pl | 4 +- test_regress/t/t_inst_tree_inl0_pub0.pl | 12 +-- test_regress/t/t_inst_tree_inl1_pub0.pl | 6 +- test_regress/t/t_inst_tree_inl1_pub1.pl | 6 +- test_regress/t/t_trace_public_sig_vlt.pl | 2 +- test_regress/t/t_unopt_combo_isolate.pl | 10 +-- test_regress/t/t_unopt_combo_isolate_vlt.pl | 10 +-- test_regress/t/t_xml_first.out | 90 ++++++++++---------- test_regress/t/t_xml_output.out | 8 +- test_regress/t/t_xml_tag.out | 94 ++++++++++----------- 23 files changed, 165 insertions(+), 147 deletions(-) diff --git a/Changes b/Changes index 6d0b6c432..aff2e9be8 100644 --- a/Changes +++ b/Changes @@ -15,6 +15,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Add parameter values in XML. #2110. [Pieter Kapsenberg] +**** Add loc column location in XML (replaces fl). #2122. [Pieter Kapsenberg] + **** Add error on misused define. [Topa Tota] diff --git a/bin/verilator b/bin/verilator index 199dd7e28..272860bf6 100755 --- a/bin/verilator +++ b/bin/verilator @@ -4669,6 +4669,11 @@ variable attribute will be removed no sooner than July 2020. The -msg argument to lint_off has been replaced with -rule. -msg is planned for removal no sooner than January 2021. +=item XML locations + +The XML C attribute has been replaced with C. C is planned +for removal no sooner than January 2021. + =back diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index c1f09316c..e21d24d0b 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -71,6 +71,7 @@ class EmitXmlFileVisitor : public AstNVisitor { void outputTag(AstNode* nodep, string tag) { if (tag=="") tag = VString::downcase(nodep->typeName()); puts("<"+tag+" "+nodep->fileline()->xml()); + puts(" "+nodep->fileline()->xmlDetailedLocation()); if (VN_IS(nodep, NodeDType)) { puts(" id="); outputId(nodep); } if (nodep->name()!="") { puts(" name="); putsQuoted(nodep->prettyName()); } if (nodep->tag()!="") { puts(" tag="); putsQuoted(nodep->tag()); } diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index b6cceec76..d27440602 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -158,6 +158,15 @@ FileLine::FileLine(FileLine::EmptySecret) { } } +const string FileLine::xmlDetailedLocation() const { + return "loc=\"" + + cvtToStr(filenameLetters()) + "," + + cvtToStr(firstLineno()) + "," + + cvtToStr(firstColumn()) + "," + + cvtToStr(lastLineno()) + "," + + cvtToStr(lastColumn()) + "\""; +} + string FileLine::lineDirectiveStrg(int enterExit) const { char numbuf[20]; sprintf(numbuf, "%d", lastLineno()); char levelbuf[20]; sprintf(levelbuf, "%d", enterExit); diff --git a/src/V3FileLine.h b/src/V3FileLine.h index f515a1408..94cb06c6c 100644 --- a/src/V3FileLine.h +++ b/src/V3FileLine.h @@ -183,6 +183,7 @@ public: const string filebasenameNoExt() const; const string profileFuncname() const; const string xml() const { return "fl=\""+filenameLetters()+cvtToStr(lastLineno())+"\""; } + const string xmlDetailedLocation() const; string lineDirectiveStrg(int enterExit) const; // Turn on/off warning messages on this line. diff --git a/test_regress/t/t_clk_concat.pl b/test_regress/t/t_clk_concat.pl index abe880617..fd7224cbf 100755 --- a/test_regress/t/t_clk_concat.pl +++ b/test_regress/t/t_clk_concat.pl @@ -16,9 +16,9 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_clk_concat_vlt.pl b/test_regress/t/t_clk_concat_vlt.pl index 965daacd9..8c882f901 100755 --- a/test_regress/t/t_clk_concat_vlt.pl +++ b/test_regress/t/t_clk_concat_vlt.pl @@ -17,10 +17,10 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_dedupe_clk_gate.pl b/test_regress/t/t_dedupe_clk_gate.pl index 99b5982d1..85b870fb2 100755 --- a/test_regress/t/t_dedupe_clk_gate.pl +++ b/test_regress/t/t_dedupe_clk_gate.pl @@ -16,7 +16,7 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); file_grep($Self->{stats}, qr/Optimizations, Gate sigs deduped\s+(\d+)/i, 4); } diff --git a/test_regress/t/t_dpi_var.pl b/test_regress/t/t_dpi_var.pl index 652a9657f..48029f606 100755 --- a/test_regress/t/t_dpi_var.pl +++ b/test_regress/t/t_dpi_var.pl @@ -17,10 +17,10 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_dpi_var_vlt.pl b/test_regress/t/t_dpi_var_vlt.pl index bc0af71ca..a6004fdc2 100755 --- a/test_regress/t/t_dpi_var_vlt.pl +++ b/test_regress/t/t_dpi_var_vlt.pl @@ -19,10 +19,10 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_func_dotted_inl0.pl b/test_regress/t/t_func_dotted_inl0.pl index de41c1dc4..f1ece27d9 100755 --- a/test_regress/t/t_func_dotted_inl0.pl +++ b/test_regress/t/t_func_dotted_inl0.pl @@ -17,10 +17,10 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_func_dotted_inl0_vlt.pl b/test_regress/t/t_func_dotted_inl0_vlt.pl index b8c833d2c..92a4a7d81 100755 --- a/test_regress/t/t_func_dotted_inl0_vlt.pl +++ b/test_regress/t/t_func_dotted_inl0_vlt.pl @@ -17,10 +17,10 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_func_dotted_inl2.pl b/test_regress/t/t_func_dotted_inl2.pl index 9784092cd..c6355044c 100755 --- a/test_regress/t/t_func_dotted_inl2.pl +++ b/test_regress/t/t_func_dotted_inl2.pl @@ -17,8 +17,8 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_func_dotted_inl2_vlt.pl b/test_regress/t/t_func_dotted_inl2_vlt.pl index 32a36011f..a2c0873b2 100755 --- a/test_regress/t/t_func_dotted_inl2_vlt.pl +++ b/test_regress/t/t_func_dotted_inl2_vlt.pl @@ -17,8 +17,8 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_inst_tree_inl0_pub0.pl b/test_regress/t/t_inst_tree_inl0_pub0.pl index 2ee859437..20bb1d857 100755 --- a/test_regress/t/t_inst_tree_inl0_pub0.pl +++ b/test_regress/t/t_inst_tree_inl0_pub0.pl @@ -17,12 +17,12 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_inst_tree_inl1_pub0.pl b/test_regress/t/t_inst_tree_inl1_pub0.pl index c30155c2b..fe4c65c1e 100755 --- a/test_regress/t/t_inst_tree_inl1_pub0.pl +++ b/test_regress/t/t_inst_tree_inl1_pub0.pl @@ -17,9 +17,9 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_inst_tree_inl1_pub1.pl b/test_regress/t/t_inst_tree_inl1_pub1.pl index abd93f9a5..7124a2dce 100755 --- a/test_regress/t/t_inst_tree_inl1_pub1.pl +++ b/test_regress/t/t_inst_tree_inl1_pub1.pl @@ -18,9 +18,9 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_trace_public_sig_vlt.pl b/test_regress/t/t_trace_public_sig_vlt.pl index 68c888339..e8140045a 100755 --- a/test_regress/t/t_trace_public_sig_vlt.pl +++ b/test_regress/t/t_trace_public_sig_vlt.pl @@ -19,7 +19,7 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_unopt_combo_isolate.pl b/test_regress/t/t_unopt_combo_isolate.pl index d43183607..874c44f07 100755 --- a/test_regress/t/t_unopt_combo_isolate.pl +++ b/test_regress/t/t_unopt_combo_isolate.pl @@ -18,11 +18,11 @@ compile( if ($Self->{vlt_all}) { file_grep($Self->{stats}, qr/Optimizations, isolate_assignments blocks\s+5/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_unopt_combo_isolate_vlt.pl b/test_regress/t/t_unopt_combo_isolate_vlt.pl index 855ac8b0e..25cf700f7 100755 --- a/test_regress/t/t_unopt_combo_isolate_vlt.pl +++ b/test_regress/t/t_unopt_combo_isolate_vlt.pl @@ -18,11 +18,11 @@ compile( if ($Self->{vlt_all}) { file_grep($Self->{stats}, qr/Optimizations, isolate_assignments blocks\s+5/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_xml_first.out b/test_regress/t/t_xml_first.out index d40bc7c59..8a909a3b3 100644 --- a/test_regress/t/t_xml_first.out +++ b/test_regress/t/t_xml_first.out @@ -17,69 +17,69 @@ - - - - - - - - + + + + + + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - - - - + + + + + + + - - - - + + + + diff --git a/test_regress/t/t_xml_output.out b/test_regress/t/t_xml_output.out index 51ce46889..0b540c9c4 100644 --- a/test_regress/t/t_xml_output.out +++ b/test_regress/t/t_xml_output.out @@ -14,11 +14,11 @@ - - + + - - + + diff --git a/test_regress/t/t_xml_tag.out b/test_regress/t/t_xml_tag.out index 3b7dab8cd..5425cecf2 100644 --- a/test_regress/t/t_xml_tag.out +++ b/test_regress/t/t_xml_tag.out @@ -16,67 +16,67 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - + +