27
27
#include " absl/status/statusor.h"
28
28
#include " absl/strings/str_cat.h"
29
29
#include " absl/strings/str_format.h"
30
+ #include " absl/strings/str_join.h"
30
31
#include " riegeli/bytes/fd_writer.h"
31
32
#include " riegeli/csv/csv_record.h"
32
33
#include " riegeli/csv/csv_writer.h"
@@ -97,7 +98,8 @@ constexpr riegeli::CsvHeaderConstant kNodeHeader = {"name",
97
98
" area_um" ,
98
99
" file" ,
99
100
" line" ,
100
- " range" };
101
+ " range" ,
102
+ " all_locs" };
101
103
riegeli::CsvRecord NodeRecord (const viz::Node& node) {
102
104
return riegeli::CsvRecord (
103
105
*kNodeHeader ,
@@ -131,7 +133,6 @@ riegeli::CsvRecord NodeRecord(const viz::Node& node) {
131
133
node.attributes ().has_area_um ()
132
134
? ToFieldValue (static_cast <int64_t >(node.attributes ().area_um ()))
133
135
: " " ,
134
- // TODO(allight): Handle nodes with multiple associated locations.
135
136
node.loc_size () >= 1 && absl::c_all_of (node.loc (),
136
137
[&](auto loc) {
137
138
return loc.file () ==
@@ -141,6 +142,10 @@ riegeli::CsvRecord NodeRecord(const viz::Node& node) {
141
142
: " " ,
142
143
node.loc_size () == 1 ? ToFieldValue (node.loc ()[0 ].line ()) : " " ,
143
144
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
+ }),
144
149
});
145
150
}
146
151
0 commit comments