Fix re-allocation in AttrWithString::ReplaceString() to use the allocator assosciated with ASTContext.

llvm-svn: 95931
This commit is contained in:
Ted Kremenek 2010-02-11 22:44:22 +00:00
parent 2c809308ca
commit 9c8a6f5a8e
1 changed files with 1 additions and 1 deletions

View File

@ -40,7 +40,7 @@ void AttrWithString::Destroy(ASTContext &C) {
void AttrWithString::ReplaceString(ASTContext &C, llvm::StringRef newS) {
if (newS.size() > StrLen) {
C.Deallocate(const_cast<char*>(Str));
Str = new char[newS.size()];
Str = new (C) char[newS.size()];
}
StrLen = newS.size();
memcpy(const_cast<char*>(Str), newS.data(), StrLen);