summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/CommentLexer.h4
-rw-r--r--clang/include/clang/AST/CommentParser.h4
-rw-r--r--clang/lib/AST/CommentParser.cpp3
3 files changed, 6 insertions, 5 deletions
diff --git a/clang/include/clang/AST/CommentLexer.h b/clang/include/clang/AST/CommentLexer.h
index f8dfd278ee0..6683788227d 100644
--- a/clang/include/clang/AST/CommentLexer.h
+++ b/clang/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/clang/include/clang/AST/CommentParser.h b/clang/include/clang/AST/CommentParser.h
index 53c58662bf3..e75d7978b77 100644
--- a/clang/include/clang/AST/CommentParser.h
+++ b/clang/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/clang/lib/AST/CommentParser.cpp b/clang/lib/AST/CommentParser.cpp
index 75eae46b8b7..14a2d85ae4b 100644
--- a/clang/lib/AST/CommentParser.cpp
+++ b/clang/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)) {
OpenPOWER on IntegriCloud