From: Anders Carlsson Date: Sat, 30 May 2009 20:34:37 +0000 (+0000) Subject: Small fixes to CXXTemporary and CXXBindTemporaryExpr. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b859f35459ae3e1188d1e1b86df08d649695fd86;p=clang Small fixes to CXXTemporary and CXXBindTemporaryExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72628 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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,