| 112 | } |
| 113 | |
| 114 | IndexUpdate IndexUpdate::createDelta(IndexFile *previous, IndexFile *current) { |
| 115 | IndexUpdate r; |
| 116 | static IndexFile empty(current->path, "<empty>", false); |
| 117 | if (previous) |
| 118 | r.prev_lid2path = std::move(previous->lid2path); |
| 119 | else |
| 120 | previous = ∅ |
| 121 | r.lid2path = std::move(current->lid2path); |
| 122 | |
| 123 | r.funcs_hint = int(current->usr2func.size() - previous->usr2func.size()); |
| 124 | for (auto &it : previous->usr2func) { |
| 125 | auto &func = it.second; |
| 126 | if (func.def.detailed_name[0]) |
| 127 | r.funcs_removed.emplace_back(func.usr, convert(func.def)); |
| 128 | r.funcs_declarations[func.usr].first = std::move(func.declarations); |
| 129 | r.funcs_uses[func.usr].first = std::move(func.uses); |
| 130 | r.funcs_derived[func.usr].first = std::move(func.derived); |
| 131 | } |
| 132 | for (auto &it : current->usr2func) { |
| 133 | auto &func = it.second; |
| 134 | if (func.def.detailed_name[0]) |
| 135 | r.funcs_def_update.emplace_back(it.first, convert(func.def)); |
| 136 | r.funcs_declarations[func.usr].second = std::move(func.declarations); |
| 137 | r.funcs_uses[func.usr].second = std::move(func.uses); |
| 138 | r.funcs_derived[func.usr].second = std::move(func.derived); |
| 139 | } |
| 140 | |
| 141 | r.types_hint = int(current->usr2type.size() - previous->usr2type.size()); |
| 142 | for (auto &it : previous->usr2type) { |
| 143 | auto &type = it.second; |
| 144 | if (type.def.detailed_name[0]) |
| 145 | r.types_removed.emplace_back(type.usr, convert(type.def)); |
| 146 | r.types_declarations[type.usr].first = std::move(type.declarations); |
| 147 | r.types_uses[type.usr].first = std::move(type.uses); |
| 148 | r.types_derived[type.usr].first = std::move(type.derived); |
| 149 | r.types_instances[type.usr].first = std::move(type.instances); |
| 150 | }; |
| 151 | for (auto &it : current->usr2type) { |
| 152 | auto &type = it.second; |
| 153 | if (type.def.detailed_name[0]) |
| 154 | r.types_def_update.emplace_back(it.first, convert(type.def)); |
| 155 | r.types_declarations[type.usr].second = std::move(type.declarations); |
| 156 | r.types_uses[type.usr].second = std::move(type.uses); |
| 157 | r.types_derived[type.usr].second = std::move(type.derived); |
| 158 | r.types_instances[type.usr].second = std::move(type.instances); |
| 159 | }; |
| 160 | |
| 161 | r.vars_hint = int(current->usr2var.size() - previous->usr2var.size()); |
| 162 | for (auto &it : previous->usr2var) { |
| 163 | auto &var = it.second; |
| 164 | if (var.def.detailed_name[0]) |
| 165 | r.vars_removed.emplace_back(var.usr, var.def); |
| 166 | r.vars_declarations[var.usr].first = std::move(var.declarations); |
| 167 | r.vars_uses[var.usr].first = std::move(var.uses); |
| 168 | } |
| 169 | for (auto &it : current->usr2var) { |
| 170 | auto &var = it.second; |
| 171 | if (var.def.detailed_name[0]) |
nothing calls this directly
no test coverage detected