diff options
-rw-r--r-- | include/clang/AST/CommentLexer.h | 4 | ||||
-rw-r--r-- | include/clang/AST/CommentParser.h | 4 | ||||
-rw-r--r-- | lib/AST/CommentParser.cpp | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/include/clang/AST/CommentLexer.h b/include/clang/AST/CommentLexer.h index f8dfd278ee..6683788227 100644 --- a/include/clang/AST/CommentLexer.h +++ b/include/clang/AST/CommentLexer.h @@ -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); diff --git a/include/clang/AST/CommentParser.h b/include/clang/AST/CommentParser.h index 53c58662bf..e75d7978b7 100644 --- a/include/clang/AST/CommentParser.h +++ b/include/clang/AST/CommentParser.h @@ -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); diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp index 75eae46b8b..14a2d85ae4 100644 --- a/lib/AST/CommentParser.cpp +++ b/lib/AST/CommentParser.cpp @@ -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)) { |