From b859f35459ae3e1188d1e1b86df08d649695fd86 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 30 May 2009 20:34:37 +0000 Subject: [PATCH] Small fixes to CXXTemporary and CXXBindTemporaryExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72628 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ExprCXX.h | 7 ++++--- lib/AST/ExprCXX.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index ed713c843b..0548a7212d 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -415,13 +415,14 @@ public: /// CXXTemporary - Represents a C++ temporary. class CXXTemporary { /// Destructor - The destructor that needs to be called. - CXXDestructorDecl *Destructor; + const CXXDestructorDecl *Destructor; - CXXTemporary(CXXDestructorDecl *destructor) + CXXTemporary(const CXXDestructorDecl *destructor) : Destructor(destructor) { } public: - static CXXTemporary *Create(ASTContext &C, CXXDestructorDecl *Destructor); + static CXXTemporary *Create(ASTContext &C, + const CXXDestructorDecl *Destructor); }; /// CXXBindTemporaryExpr - Represents binding an expression to a temporary, diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index d0032fb5e5..f757ac0a89 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -237,7 +237,7 @@ const char *CXXNamedCastExpr::getCastName() const { } CXXTemporary *CXXTemporary::Create(ASTContext &C, - CXXDestructorDecl *Destructor) { + const CXXDestructorDecl *Destructor) { // FIXME: Allocate using the ASTContext. return new CXXTemporary(Destructor); } @@ -248,7 +248,7 @@ CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C, assert(SubExpr->getType()->isRecordType() && "Expression bound to a temporary must have record type!"); - return new CXXBindTemporaryExpr(Temp, SubExpr); + return new (C) CXXBindTemporaryExpr(Temp, SubExpr); } CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd, -- 2.40.0