| 303 | } |
| 304 | |
| 305 | void Function::syncDataWithSrc(Function &src) { |
| 306 | auto IS = src.inputs.begin(), ES = src.inputs.end(); |
| 307 | auto IT = inputs.begin(), ET = inputs.end(); |
| 308 | |
| 309 | for (; IS != ES && IT != ET; ++IS, ++IT) { |
| 310 | if (auto in_tgt = dynamic_cast<Input*>(IT->get())) |
| 311 | in_tgt->copySMTName(*dynamic_cast<Input*>(IS->get())); |
| 312 | |
| 313 | if (!(IS->get()->getType() == IT->get()->getType()).isTrue()) |
| 314 | throw AliveException("Source and target args have different type", false); |
| 315 | } |
| 316 | |
| 317 | if (IS != ES || IT != ET) |
| 318 | throw AliveException("Source and target have different number of args", |
| 319 | false); |
| 320 | |
| 321 | // copy function decls that are called indirectly |
| 322 | auto copy_fns = [](const auto &src, auto &dst) { |
| 323 | for (auto &c : src.getConstants()) { |
| 324 | auto *gv = dynamic_cast<const GlobalVariable*>(&c); |
| 325 | if (gv && gv->isArbitrarySize() && !dst.getGlobalVar(gv->getName())) |
| 326 | dst.addConstant(make_unique<GlobalVariable>(*gv)); |
| 327 | } |
| 328 | }; |
| 329 | copy_fns(src, *this); |
| 330 | copy_fns(*this, src); |
| 331 | |
| 332 | for (auto &decl : fn_decls) { |
| 333 | src.addFnDecl(FnDecl(decl)); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | Function::instr_iterator:: |
| 338 | instr_iterator(vector<BasicBlock*>::const_iterator &&BBI, |
no test coverage detected