| 331 | } |
| 332 | |
| 333 | const retdec::common::Object* Config::insertStackVariable( |
| 334 | const llvm::AllocaInst* sv, |
| 335 | int offset, |
| 336 | bool fromDebug, |
| 337 | const std::string& realName) |
| 338 | { |
| 339 | auto* cf = getConfigFunction(sv->getFunction()); |
| 340 | |
| 341 | if (cf == nullptr) |
| 342 | { |
| 343 | assert(false); |
| 344 | } |
| 345 | |
| 346 | assert(cf); |
| 347 | if (cf == nullptr) |
| 348 | { |
| 349 | return nullptr; |
| 350 | } |
| 351 | |
| 352 | retdec::common::Object local( |
| 353 | sv->getName(), |
| 354 | retdec::common::Storage::onStack(offset)); |
| 355 | if (realName.empty()) |
| 356 | { |
| 357 | local.setRealName(sv->getName()); |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | local.setRealName(realName); |
| 362 | } |
| 363 | local.setIsFromDebug(fromDebug); |
| 364 | local.type.setLlvmIr(llvmObjToString(sv->getType())); |
| 365 | |
| 366 | auto p = cf->locals.insert(local); |
| 367 | return &(*p.first); |
| 368 | } |
| 369 | |
| 370 | const retdec::common::Function* Config::insertFunction( |
| 371 | const llvm::Function* fnc, |