| 272 | } |
| 273 | |
| 274 | void AllocSizeAnalyzer::updateFieldFlow(ArgFlow &AF, std::vector<int> Indices) { |
| 275 | auto &A = AF.getLLVMArg(); |
| 276 | auto *T = A.getType(); |
| 277 | while (isa<llvm::PointerType>(T)) |
| 278 | T = T->getPointerElementType(); |
| 279 | |
| 280 | auto *ST = dyn_cast_or_null<llvm::StructType>(T); |
| 281 | if (!ST) |
| 282 | return; |
| 283 | |
| 284 | for (unsigned S = 0; S < ST->getNumElements(); ++S) { |
| 285 | Indices.push_back(S); |
| 286 | if (Report.has(A, Indices)) { |
| 287 | AF.setStruct(ST); |
| 288 | auto &FF = AF.getOrCreateFieldFlow(S); |
| 289 | if (Report.get(A, Indices)) |
| 290 | FF.setAllocSize(); |
| 291 | updateFieldFlow(FF, Indices); |
| 292 | } |
| 293 | Indices.pop_back(); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | void AllocSizeAnalyzer::updateDefault(const llvm::Module &M) { |
| 298 | ManualAllocLoader MAL; |
nothing calls this directly
no test coverage detected