mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 05:56:06 +00:00
[Edit] Use StringRef's copy method. No functional change intended.
llvm-svn: 243968
This commit is contained in:
parent
e2453afff6
commit
323dc2d064
@ -134,12 +134,6 @@ private:
|
||||
SourceLocation *MacroBegin = nullptr) const;
|
||||
bool isAtEndOfMacroExpansion(SourceLocation loc,
|
||||
SourceLocation *MacroEnd = nullptr) const;
|
||||
|
||||
StringRef copyString(StringRef str) {
|
||||
char *buf = StrAlloc.Allocate<char>(str.size());
|
||||
std::memcpy(buf, str.data(), str.size());
|
||||
return StringRef(buf, str.size());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -62,11 +62,7 @@ public:
|
||||
void applyRewrites(EditsReceiver &receiver);
|
||||
void clearRewrites();
|
||||
|
||||
StringRef copyString(StringRef str) {
|
||||
char *buf = StrAlloc.Allocate<char>(str.size());
|
||||
std::memcpy(buf, str.data(), str.size());
|
||||
return StringRef(buf, str.size());
|
||||
}
|
||||
StringRef copyString(StringRef str) { return str.copy(StrAlloc); }
|
||||
StringRef copyString(const Twine &twine);
|
||||
|
||||
private:
|
||||
|
@ -183,7 +183,7 @@ void Commit::addInsert(SourceLocation OrigLoc, FileOffset Offs, StringRef text,
|
||||
data.Kind = Act_Insert;
|
||||
data.OrigLoc = OrigLoc;
|
||||
data.Offset = Offs;
|
||||
data.Text = copyString(text);
|
||||
data.Text = text.copy(StrAlloc);
|
||||
data.BeforePrev = beforePreviousInsertions;
|
||||
CachedEdits.push_back(data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user