privatize all of the string literal memory allocation/creation
stuff behind a private static function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64898 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 48f338e..b2df86a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -352,17 +352,13 @@
StrTy = Context.getConstantArrayType(StrTy,
llvm::APInt(32, Literal.GetStringLength()+1),
ArrayType::Normal, 0);
- // Allocate enough space for the StringLiteral plus an array of locations for
- // any concatenated strings.
- void *Mem = Context.Allocate(sizeof(StringLiteral)+
- sizeof(SourceLocation)*(NumStringToks-1));
// Pass &StringTokLocs[0], StringTokLocs.size() to factory!
- return Owned(new (Mem) StringLiteral(Context, Literal.GetString(),
- Literal.GetStringLength(),
- Literal.AnyWide, StrTy,
- &StringTokLocs[0],
- StringTokLocs.size()));
+ return Owned(StringLiteral::Create(Context, Literal.GetString(),
+ Literal.GetStringLength(),
+ Literal.AnyWide, StrTy,
+ &StringTokLocs[0],
+ StringTokLocs.size()));
}
/// ShouldSnapshotBlockValueReference - Return true if a reference inside of