diff options
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index ce13c34012..d627ab03b2 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -38,12 +38,13 @@ double FloatingLiteral::getValueAsApproximateDouble() const { } -StringLiteral::StringLiteral(const char *strData, unsigned byteLength, - bool Wide, QualType t, SourceLocation firstLoc, +StringLiteral::StringLiteral(ASTContext& C, const char *strData, + unsigned byteLength, bool Wide, QualType t, + SourceLocation firstLoc, SourceLocation lastLoc) : Expr(StringLiteralClass, t) { // OPTIMIZE: could allocate this appended to the StringLiteral. - char *AStrData = new char[byteLength]; + char *AStrData = new (C, 1) char[byteLength]; memcpy(AStrData, strData, byteLength); StrData = AStrData; ByteLength = byteLength; @@ -52,8 +53,9 @@ StringLiteral::StringLiteral(const char *strData, unsigned byteLength, lastTokLoc = lastLoc; } -StringLiteral::~StringLiteral() { - delete[] StrData; +void StringLiteral::Destroy(ASTContext &C) { + C.Deallocate(const_cast<char*>(StrData)); + this->~StringLiteral(); } bool UnaryOperator::isPostfix(Opcode Op) { |