MCPcopy Create free account
hub / github.com/Samsung/UTopia / addReplace

Method addReplace

lib/generation/UTModify.cpp:65–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool 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
83const std::map<std::string, std::string> &UTModify::getNewFiles() const {
84 return FileNewMap;

Callers

nothing calls this directly

Calls 3

getFilePathMethod · 0.45
getOffsetMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected