зеркало из https://github.com/microsoft/clang-1.git
Stop using new[] on llvm::BumpPtrAllocator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159833 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
9bf997e63d
Коммит
814e219fc6
|
@ -479,7 +479,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
char *TextPtr = new (Allocator) char[Length + 1];
|
||||
char *TextPtr = Allocator.Allocate<char>(Length + 1);
|
||||
|
||||
memcpy(TextPtr, WordText.c_str(), Length + 1);
|
||||
StringRef Text = StringRef(TextPtr, Length);
|
||||
|
@ -525,7 +525,7 @@ public:
|
|||
}
|
||||
|
||||
const unsigned Length = WordText.size();
|
||||
char *TextPtr = new (Allocator) char[Length + 1];
|
||||
char *TextPtr = Allocator.Allocate<char>(Length + 1);
|
||||
|
||||
memcpy(TextPtr, WordText.c_str(), Length + 1);
|
||||
StringRef Text = StringRef(TextPtr, Length);
|
||||
|
|
|
@ -34,8 +34,8 @@ class Parser {
|
|||
ArrayRef<T> copyArray(ArrayRef<T> Source) {
|
||||
size_t Size = Source.size();
|
||||
if (Size != 0) {
|
||||
T *Mem = new (Allocator) T[Size];
|
||||
std::copy(Source.begin(), Source.end(), Mem);
|
||||
T *Mem = Allocator.Allocate<T>(Size);
|
||||
std::uninitialized_copy(Source.begin(), Source.end(), Mem);
|
||||
return llvm::makeArrayRef(Mem, Size);
|
||||
} else
|
||||
return llvm::makeArrayRef(static_cast<T *>(NULL), 0);
|
||||
|
|
|
@ -47,7 +47,8 @@ BlockCommandComment *Parser::parseBlockCommandArgs(
|
|||
TextTokenRetokenizer &Retokenizer,
|
||||
unsigned NumArgs) {
|
||||
typedef BlockCommandComment::Argument Argument;
|
||||
Argument *Args = new (Allocator) Argument[NumArgs];
|
||||
Argument *Args =
|
||||
new (Allocator.Allocate<Argument>(NumArgs)) Argument[NumArgs];
|
||||
unsigned ParsedArgs = 0;
|
||||
Token Arg;
|
||||
while (ParsedArgs < NumArgs && Retokenizer.lexWord(Arg)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче