2727#include " absl/status/statusor.h"
2828#include " absl/strings/str_cat.h"
2929#include " absl/strings/str_format.h"
30+ #include " absl/strings/str_join.h"
3031#include " riegeli/bytes/fd_writer.h"
3132#include " riegeli/csv/csv_record.h"
3233#include " riegeli/csv/csv_writer.h"
@@ -97,7 +98,8 @@ constexpr riegeli::CsvHeaderConstant kNodeHeader = {"name",
9798 " area_um" ,
9899 " file" ,
99100 " line" ,
100- " range" };
101+ " range" ,
102+ " all_locs" };
101103riegeli::CsvRecord NodeRecord (const viz::Node& node) {
102104 return riegeli::CsvRecord (
103105 *kNodeHeader ,
@@ -131,7 +133,6 @@ riegeli::CsvRecord NodeRecord(const viz::Node& node) {
131133 node.attributes ().has_area_um ()
132134 ? ToFieldValue (static_cast <int64_t >(node.attributes ().area_um ()))
133135 : " " ,
134- // TODO(allight): Handle nodes with multiple associated locations.
135136 node.loc_size () >= 1 && absl::c_all_of (node.loc (),
136137 [&](auto loc) {
137138 return loc.file () ==
@@ -141,6 +142,10 @@ riegeli::CsvRecord NodeRecord(const viz::Node& node) {
141142 : " " ,
142143 node.loc_size () == 1 ? ToFieldValue (node.loc ()[0 ].line ()) : " " ,
143144 node.attributes ().has_ranges () ? node.attributes ().ranges () : " " ,
145+ absl::StrJoin (node.loc (), " \n " ,
146+ [](std::string* out, const auto & loc) {
147+ absl::StrAppend (out, loc.file (), " :" , loc.line ());
148+ }),
144149 });
145150}
146151
0 commit comments