From: Anders Carlsson Date: Sat, 30 May 2009 21:05:25 +0000 (+0000) Subject: Stop using CXXTempVarDecl and use CXXTemporary instead. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff6b3d64c9f07155f1414411b8451d7bf8937c62;p=clang Stop using CXXTempVarDecl and use CXXTemporary instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72634 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 05ce4eebbe..b9bb588e67 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -22,7 +22,7 @@ namespace clang { class CXXConstructorDecl; class CXXDestructorDecl; - class CXXTempVarDecl; + class CXXTemporary; //===--------------------------------------------------------------------===// // C++ Expressions. @@ -1010,12 +1010,12 @@ public: class CXXExprWithTemporaries : public Expr { Stmt *SubExpr; - CXXTempVarDecl **Decls; - unsigned NumDecls; + CXXTemporary **Temps; + unsigned NumTemps; public: - CXXExprWithTemporaries(Expr *subexpr, CXXTempVarDecl **decls, - unsigned numdecls); + CXXExprWithTemporaries(Expr *subexpr, CXXTemporary **temps, + unsigned numtemps); ~CXXExprWithTemporaries(); const Expr *getSubExpr() const { return cast(SubExpr); } diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 4b43606327..fccef01260 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -294,20 +294,20 @@ void CXXConstructExpr::Destroy(ASTContext &C) { } CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr, - CXXTempVarDecl **decls, - unsigned numdecls) + CXXTemporary **temps, + unsigned numtemps) : Expr(CXXExprWithTemporariesClass, subexpr->getType(), subexpr->isTypeDependent(), subexpr->isValueDependent()), - SubExpr(subexpr), Decls(0), NumDecls(numdecls) { - if (NumDecls > 0) { - Decls = new CXXTempVarDecl*[NumDecls]; - for (unsigned i = 0; i < NumDecls; ++i) - Decls[i] = decls[i]; + SubExpr(subexpr), Temps(0), NumTemps(numtemps) { + if (NumTemps > 0) { + Temps = new CXXTemporary*[NumTemps]; + for (unsigned i = 0; i < NumTemps; ++i) + Temps[i] = temps[i]; } } CXXExprWithTemporaries::~CXXExprWithTemporaries() { - delete[] Decls; + delete[] Temps; } // CXXBindTemporaryExpr diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index f7d66daf20..ecb17755eb 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -82,6 +82,7 @@ namespace clang { class ObjCContainerDecl; class BasePaths; struct MemberLookupCriteria; + class CXXTemporary; /// BlockSemaInfo - When a block is being parsed, this contains information /// about the block. It is pointed to from Sema::CurBlock. @@ -165,7 +166,7 @@ public: /// ExprTemporaries - This is the stack of temporaries that are created by /// the current full expression. - llvm::SmallVector ExprTemporaries; + llvm::SmallVector ExprTemporaries; /// CurFunctionNeedsScopeChecking - This is set to true when a function or /// ObjC method body contains a VLA or an ObjC try block, which introduce diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index e9b68d7a5e..5d18c3c9f2 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -203,11 +203,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep, if (!Constructor) return ExprError(); - CXXTempVarDecl *Temp = CXXTempVarDecl::Create(Context, CurContext, Ty); - ExprTemporaries.push_back(Temp); - exprs.release(); - Expr *E = new (Context) CXXTemporaryObjectExpr(Context, Constructor, Ty, TyBeginLoc, Exprs, NumExprs, RParenLoc);