| 324 | } |
| 325 | |
| 326 | void FuzzInputGenerator::updateArrayInfo( |
| 327 | std::map<unsigned, std::shared_ptr<FuzzInput>> &FuzzInputMap, |
| 328 | const std::vector<std::set<unsigned>> &ArrayGroups) const { |
| 329 | |
| 330 | for (auto &ArrayGroup : ArrayGroups) { |
| 331 | const FuzzInput *ArrayDef = nullptr; |
| 332 | const FuzzInput *ArrayLenDef = nullptr; |
| 333 | |
| 334 | for (auto &ID : ArrayGroup) { |
| 335 | auto Iter = FuzzInputMap.find(ID); |
| 336 | assert(Iter != FuzzInputMap.end() && "Unexpected Program State"); |
| 337 | |
| 338 | const auto *Input = Iter->second.get(); |
| 339 | assert(Input && "Unexpected Program State"); |
| 340 | |
| 341 | if (Input->getCopyFrom()) |
| 342 | continue; |
| 343 | |
| 344 | const auto &Def = Input->getDef(); |
| 345 | if (Def.Array) { |
| 346 | if (ArrayDef) { |
| 347 | assert(ArrayDef == Input && "Unexpected Program State"); |
| 348 | } |
| 349 | ArrayDef = Input; |
| 350 | } else if (Def.ArrayLen) { |
| 351 | if (ArrayLenDef) { |
| 352 | assert(ArrayLenDef == Input && "Unexpected Program State"); |
| 353 | } |
| 354 | ArrayLenDef = Input; |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | assert(ArrayDef && "Unexpected Program State"); |
| 359 | if (!ArrayLenDef) |
| 360 | continue; |
| 361 | |
| 362 | const_cast<FuzzInput *>(ArrayDef)->ArrayLenDef = &ArrayLenDef->getDef(); |
| 363 | const_cast<FuzzInput *>(ArrayLenDef)->ArrayDef = &ArrayDef->getDef(); |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | NoInputPtr |
| 368 | FuzzNoInputFactory::generate(std::shared_ptr<const Definition> Def) const { |
nothing calls this directly
no test coverage detected