| 1307 | }; |
| 1308 | |
| 1309 | bool BacktraceData::Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index) |
| 1310 | { |
| 1311 | if (bt.Empty()) { |
| 1312 | return false; |
| 1313 | } |
| 1314 | cmListFileContext const* top = &bt.Top(); |
| 1315 | auto found = this->NodeMap.find(top); |
| 1316 | if (found != this->NodeMap.end()) { |
| 1317 | index = found->second; |
| 1318 | return true; |
| 1319 | } |
| 1320 | Json::Value entry = Json::objectValue; |
| 1321 | entry["file"] = this->AddFile(top->FilePath); |
| 1322 | if (top->Line) { |
| 1323 | entry["line"] = static_cast<int>(top->Line); |
| 1324 | } |
| 1325 | if (!top->Name.empty()) { |
| 1326 | entry["command"] = this->AddCommand(top->Name); |
| 1327 | } |
| 1328 | Json::ArrayIndex parent; |
| 1329 | if (this->Add(bt.Pop(), parent)) { |
| 1330 | entry["parent"] = parent; |
| 1331 | } |
| 1332 | index = this->NodeMap[top] = this->Nodes.size(); |
| 1333 | this->Nodes.append(std::move(entry)); // NOLINT(*) |
| 1334 | return true; |
| 1335 | } |
| 1336 | |
| 1337 | Json::Value BacktraceData::Dump() |
| 1338 | { |
no test coverage detected