| 63 | } |
| 64 | |
| 65 | bool UTModify::addReplace(const clang::tooling::Replacement &Replace) { |
| 66 | auto Key = std::make_pair(Replace.getFilePath().str(), Replace.getOffset()); |
| 67 | const auto [It, Inserted] = Replaces.insert(std::make_pair(Key, Replace)); |
| 68 | if (Inserted) |
| 69 | return true; |
| 70 | auto Existing = It->second; |
| 71 | if (Existing.getLength() && Replace.getLength()) { |
| 72 | assert(false && "Not Mergeable Replacements Found"); |
| 73 | return false; |
| 74 | } |
| 75 | auto Merged = Replacement(Existing.getFilePath(), Existing.getOffset(), |
| 76 | Existing.getLength() + Replace.getLength(), |
| 77 | Existing.getReplacementText().str() + |
| 78 | Replace.getReplacementText().str()); |
| 79 | Replaces.insert_or_assign(Key, Merged); |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | const std::map<std::string, std::string> &UTModify::getNewFiles() const { |
| 84 | return FileNewMap; |
nothing calls this directly
no test coverage detected