This represents all of the data that is only valid for the duration of a single compilation.
| 187 | // This represents all of the data that is only valid for the duration of |
| 188 | // a single compilation. |
| 189 | uint32_t AssemblyContext::spvNamedIdAssignOrGet(const char* textValue) { |
| 190 | if (!ids_to_preserve_.empty()) { |
| 191 | uint32_t id = 0; |
| 192 | if (spvtools::utils::ParseNumber(textValue, &id)) { |
| 193 | if (ids_to_preserve_.find(id) != ids_to_preserve_.end()) { |
| 194 | bound_ = std::max(bound_, id + 1); |
| 195 | return id; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | const auto it = named_ids_.find(textValue); |
| 201 | if (it == named_ids_.end()) { |
| 202 | uint32_t id = next_id_++; |
| 203 | if (!ids_to_preserve_.empty()) { |
| 204 | while (ids_to_preserve_.find(id) != ids_to_preserve_.end()) { |
| 205 | id = next_id_++; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | named_ids_.emplace(textValue, id); |
| 210 | bound_ = std::max(bound_, id + 1); |
| 211 | return id; |
| 212 | } |
| 213 | |
| 214 | return it->second; |
| 215 | } |
| 216 | |
| 217 | uint32_t AssemblyContext::getBound() const { return bound_; } |
| 218 |
no test coverage detected