forked from OSchip/llvm-project
Fix re-allocation in AttrWithString::ReplaceString() to use the allocator assosciated with ASTContext.
llvm-svn: 95931
This commit is contained in:
parent
2c809308ca
commit
9c8a6f5a8e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue