[cfe-commits] r72633 - in /cfe/trunk: include/clang/AST/ExprCXX.h lib/AST/ExprCXX.cpp lib/CodeGen/CGExprAgg.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaTemplateInstantiateExpr.cpp
Anders Carlsson
andersca at mac.com
Sat May 30 13:56:46 PDT 2009
Author: andersca
Date: Sat May 30 15:56:46 2009
New Revision: 72633
URL: http://llvm.org/viewvc/llvm-project?rev=72633&view=rev
Log:
Remove VarDecl from CXXConstructExpr.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Sat May 30 15:56:46 2009
@@ -458,7 +458,6 @@
/// CXXConstructExpr - Represents a call to a C++ constructor.
class CXXConstructExpr : public Expr {
- VarDecl *VD;
CXXConstructorDecl *Constructor;
bool Elidable;
@@ -468,19 +467,18 @@
protected:
- CXXConstructExpr(ASTContext &C, StmtClass SC, VarDecl *vd, QualType T,
+ CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
CXXConstructorDecl *d, bool elidable,
Expr **args, unsigned numargs);
~CXXConstructExpr() { }
public:
- static CXXConstructExpr *Create(ASTContext &C, VarDecl *VD, QualType T,
+ static CXXConstructExpr *Create(ASTContext &C, QualType T,
CXXConstructorDecl *D, bool Elidable,
Expr **Args, unsigned NumArgs);
void Destroy(ASTContext &C);
- VarDecl* getVarDecl() const { return VD; }
CXXConstructorDecl* getConstructor() const { return Constructor; }
/// \brief Whether this construction is elidable.
@@ -558,10 +556,10 @@
SourceLocation RParenLoc;
public:
- CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd,
- CXXConstructorDecl *Cons, QualType writtenTy,
- SourceLocation tyBeginLoc, Expr **Args,
- unsigned NumArgs, SourceLocation rParenLoc);
+ CXXTemporaryObjectExpr(ASTContext &C, CXXConstructorDecl *Cons,
+ QualType writtenTy, SourceLocation tyBeginLoc,
+ Expr **Args,unsigned NumArgs,
+ SourceLocation rParenLoc);
~CXXTemporaryObjectExpr() { }
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Sat May 30 15:56:46 2009
@@ -251,35 +251,33 @@
return new (C) CXXBindTemporaryExpr(Temp, SubExpr);
}
-CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd,
+CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C,
CXXConstructorDecl *Cons,
QualType writtenTy,
SourceLocation tyBeginLoc,
Expr **Args,
unsigned NumArgs,
SourceLocation rParenLoc)
- : CXXConstructExpr(C, CXXTemporaryObjectExprClass, vd, writtenTy, Cons,
+ : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, Cons,
false, Args, NumArgs),
TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {
}
-CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, VarDecl *VD,
- QualType T, CXXConstructorDecl *D,
- bool Elidable,
+CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, QualType T,
+ CXXConstructorDecl *D, bool Elidable,
Expr **Args, unsigned NumArgs) {
- return new (C) CXXConstructExpr(C, CXXConstructExprClass, VD, T, D, Elidable,
+ return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, D, Elidable,
Args, NumArgs);
}
-CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, VarDecl *vd,
- QualType T, CXXConstructorDecl *D,
- bool elidable,
+CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
+ CXXConstructorDecl *D, bool elidable,
Expr **args, unsigned numargs)
: Expr(SC, T,
T->isDependentType(),
(T->isDependentType() ||
CallExpr::hasAnyValueDependentArguments(args, numargs))),
- VD(vd), Constructor(D), Elidable(elidable), Args(0), NumArgs(numargs) {
+ Constructor(D), Elidable(elidable), Args(0), NumArgs(numargs) {
if (NumArgs > 0) {
Args = new (C) Stmt*[NumArgs];
for (unsigned i = 0; i < NumArgs; ++i)
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sat May 30 15:56:46 2009
@@ -292,17 +292,9 @@
void
AggExprEmitter::VisitCXXConstructExpr(const CXXConstructExpr *E) {
- llvm::Value *V = DestPtr;
-
- if (!V) {
- assert(isa<CXXTempVarDecl>(E->getVarDecl()) &&
- "Must have a temp var decl when there's no destination!");
-
- V = CGF.CreateTempAlloca(CGF.ConvertType(E->getVarDecl()->getType()),
- "tmpvar");
- }
-
- CGF.EmitCXXConstructExpr(V, E);
+ assert(DestPtr && "Must have somewhere to emit into!");
+
+ CGF.EmitCXXConstructExpr(DestPtr, E);
}
void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat May 30 15:56:46 2009
@@ -1800,7 +1800,7 @@
CXXConstructorDecl *Constructor,
QualType DeclInitType,
Expr **Exprs, unsigned NumExprs) {
- Expr *Temp = CXXConstructExpr::Create(Context, VD, DeclInitType, Constructor,
+ Expr *Temp = CXXConstructExpr::Create(Context, DeclInitType, Constructor,
false, Exprs, NumExprs);
VD->setInit(Context, Temp);
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat May 30 15:56:46 2009
@@ -208,7 +208,7 @@
exprs.release();
- Expr *E = new (Context) CXXTemporaryObjectExpr(Context, Temp, Constructor,
+ Expr *E = new (Context) CXXTemporaryObjectExpr(Context, Constructor,
Ty, TyBeginLoc, Exprs,
NumExprs, RParenLoc);
return MaybeBindToTemporary(E);
@@ -883,9 +883,8 @@
// FIXME: When can ToType be a reference type?
assert(!ToType->isReferenceType());
- CXXTempVarDecl *Temp = CXXTempVarDecl::Create(Context, CurContext, ToType);
// FIXME: Keep track of whether the copy constructor is elidable or not.
- From = CXXConstructExpr::Create(Context, Temp, ToType,
+ From = CXXConstructExpr::Create(Context, ToType,
SCS.CopyConstructor, false, &From, 1);
return false;
}
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sat May 30 15:56:46 2009
@@ -174,8 +174,8 @@
if (!Constructor)
return true;
- Init = CXXConstructExpr::Create(Context, 0, DeclType, Constructor,
- false, &Init, 1);
+ Init = CXXConstructExpr::Create(Context, DeclType, Constructor, false,
+ &Init, 1);
return false;
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp?rev=72633&r1=72632&r2=72633&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp Sat May 30 15:56:46 2009
@@ -1007,15 +1007,7 @@
Args.push_back(ArgInst.takeAs<Expr>());
}
-
- VarDecl *Var = cast_or_null<VarDecl>(SemaRef.InstantiateDecl(E->getVarDecl(),
- SemaRef.CurContext,
- TemplateArgs));
- if (!Var)
- return SemaRef.ExprError();
-
- SemaRef.CurrentInstantiationScope->InstantiatedLocal(E->getVarDecl(), Var);
- return SemaRef.Owned(CXXConstructExpr::Create(SemaRef.Context, Var, T,
+ return SemaRef.Owned(CXXConstructExpr::Create(SemaRef.Context, T,
E->getConstructor(),
E->isElidable(),
Args.takeAs<Expr>(),
More information about the cfe-commits
mailing list