Move StringLiteral to allocate its internal string data using the allocator in
ASTContext. This required changing all clients to pass in the ASTContext& to the
constructor of StringLiteral. I also changed all allocations of StringLiteral to
use new(ASTContext&).
Along the way, I updated a bunch of new()'s in StmtSerialization.cpp to use the
allocator from ASTContext& (not complete).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63958 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 3ee6e52..8c8207a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -319,7 +319,7 @@
ArrayType::Normal, 0);
// Pass &StringTokLocs[0], StringTokLocs.size() to factory!
- return Owned(new (Context) StringLiteral(Literal.GetString(),
+ return Owned(new (Context) StringLiteral(Context, Literal.GetString(),
Literal.GetStringLength(),
Literal.AnyWide, StrTy,
StringToks[0].getLocation(),
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 983231c..003e121 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -40,9 +40,9 @@
p += S->getByteLength();
delete S;
}
- S = new StringLiteral(strBuf, Length,
- isWide, Context.getPointerType(Context.CharTy),
- AtLoc, EndLoc);
+ S = new (Context, 8) StringLiteral(Context, strBuf, Length, isWide,
+ Context.getPointerType(Context.CharTy),
+ AtLoc, EndLoc);
}
if (CheckBuiltinCFStringArgument(S))