[cfe-commits] r159833 - in /cfe/trunk: include/clang/AST/CommentLexer.h include/clang/AST/CommentParser.h lib/AST/CommentParser.cpp
Dmitri Gribenko
gribozavr at gmail.com
Fri Jul 6 09:41:59 PDT 2012
Author: gribozavr
Date: Fri Jul 6 11:41:59 2012
New Revision: 159833
URL: http://llvm.org/viewvc/llvm-project?rev=159833&view=rev
Log:
Stop using new[] on llvm::BumpPtrAllocator.
Modified:
cfe/trunk/include/clang/AST/CommentLexer.h
cfe/trunk/include/clang/AST/CommentParser.h
cfe/trunk/lib/AST/CommentParser.cpp
Modified: cfe/trunk/include/clang/AST/CommentLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentLexer.h?rev=159833&r1=159832&r2=159833&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentLexer.h (original)
+++ cfe/trunk/include/clang/AST/CommentLexer.h Fri Jul 6 11:41:59 2012
@@ -479,7 +479,7 @@
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 @@
}
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);
Modified: cfe/trunk/include/clang/AST/CommentParser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentParser.h?rev=159833&r1=159832&r2=159833&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentParser.h (original)
+++ cfe/trunk/include/clang/AST/CommentParser.h Fri Jul 6 11:41:59 2012
@@ -34,8 +34,8 @@
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);
Modified: cfe/trunk/lib/AST/CommentParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentParser.cpp?rev=159833&r1=159832&r2=159833&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentParser.cpp (original)
+++ cfe/trunk/lib/AST/CommentParser.cpp Fri Jul 6 11:41:59 2012
@@ -47,7 +47,8 @@
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)) {
More information about the cfe-commits
mailing list