| 440 | } |
| 441 | |
| 442 | void ArrayAnalyzer::updateFieldFlow(ArgFlow &AF, std::vector<int> Indices) { |
| 443 | auto &A = AF.getLLVMArg(); |
| 444 | auto *T = A.getType(); |
| 445 | while (isa<llvm::PointerType>(T)) |
| 446 | T = T->getPointerElementType(); |
| 447 | |
| 448 | auto *ST = dyn_cast_or_null<llvm::StructType>(T); |
| 449 | if (!ST) |
| 450 | return; |
| 451 | |
| 452 | for (unsigned S = 0; S < ST->getNumElements(); ++S) { |
| 453 | Indices.push_back(S); |
| 454 | if (!Report->has(A, Indices)) { |
| 455 | Indices.pop_back(); |
| 456 | continue; |
| 457 | } |
| 458 | |
| 459 | AF.setStruct(ST); |
| 460 | auto &FF = AF.getOrCreateFieldFlow(S); |
| 461 | auto Value = Report->get(A, Indices); |
| 462 | if (Value == ArrayAnalysisReport::NO_ARRAY) |
| 463 | FF.setIsArray(false); |
| 464 | else |
| 465 | FF.setIsArray(true); |
| 466 | |
| 467 | auto FI = FF.getFieldInfo(); |
| 468 | if (Value >= 0 && FI) |
| 469 | FI->SizeFields = {(unsigned)Value}; |
| 470 | updateFieldFlow(FF, Indices); |
| 471 | Indices.pop_back(); |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | void ArrayAnalyzer::updateDefault(const llvm::Module &M) { |
| 476 | if (!Report) |
nothing calls this directly
no test coverage detected