| 428 | } |
| 429 | |
| 430 | void UTModify::genModifiedSrcs(const std::string &OrgSrcDir, |
| 431 | const std::string &OutDir, |
| 432 | const std::string &Signature) const { |
| 433 | for (auto Iter : FileReplaceMap) { |
| 434 | auto FilePath = Iter.first; |
| 435 | assert(!FilePath.empty() && "Unexpected Program State"); |
| 436 | auto Replacements = Iter.second; |
| 437 | |
| 438 | auto OutPath = util::rebasePath(FilePath, OrgSrcDir, OutDir); |
| 439 | applyReplacements(FilePath, OutPath, Replacements, Signature); |
| 440 | } |
| 441 | |
| 442 | for (auto Iter : FileNewMap) { |
| 443 | auto FilePath = Iter.first; |
| 444 | assert(!FilePath.empty() && "Unexpected Program State"); |
| 445 | auto Content = Signature + Iter.second; |
| 446 | |
| 447 | auto OutPath = util::rebasePath(FilePath, OrgSrcDir, OutDir); |
| 448 | util::saveFile(OutPath.c_str(), Content.c_str()); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | void UTModify::applyReplacements( |
| 453 | const std::string &OrgFilePath, const std::string &OutFilePath, |
no test coverage detected