[cfe-commits] r69981 - in /cfe/trunk: include/clang/AST/ExprCXX.h lib/AST/ExprCXX.cpp
Anders Carlsson
andersca at mac.com
Fri Apr 24 10:35:03 PDT 2009
Author: andersca
Date: Fri Apr 24 12:34:38 2009
New Revision: 69981
URL: http://llvm.org/viewvc/llvm-project?rev=69981&view=rev
Log:
Make CXXTemporaryObjectExpr inherit from CXXConstructExpr.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/lib/AST/ExprCXX.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=69981&r1=69980&r2=69981&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Fri Apr 24 12:34:38 2009
@@ -389,12 +389,12 @@
Stmt **Args;
unsigned NumArgs;
- ~CXXConstructExpr() { }
protected:
CXXConstructExpr(ASTContext &C, StmtClass SC, VarDecl *vd, QualType T,
CXXConstructorDecl *d, bool elidable,
Expr **args, unsigned numargs);
+ ~CXXConstructExpr() { }
public:
static CXXConstructExpr *Create(ASTContext &C, VarDecl *VD, QualType T,
@@ -419,7 +419,8 @@
virtual SourceRange getSourceRange() const { return SourceRange(); }
static bool classof(const Stmt *T) {
- return T->getStmtClass() == CXXConstructExprClass;
+ return T->getStmtClass() == CXXConstructExprClass ||
+ T->getStmtClass() == CXXTemporaryObjectExprClass;
}
static bool classof(const CXXConstructExpr *) { return true; }
@@ -472,12 +473,9 @@
/// return X(1, 3.14f); // creates a CXXTemporaryObjectExpr
/// };
/// @endcode
-class CXXTemporaryObjectExpr : public Expr {
+class CXXTemporaryObjectExpr : public CXXConstructExpr {
SourceLocation TyBeginLoc;
SourceLocation RParenLoc;
- CXXConstructorDecl *Constructor;
- Stmt **Args;
- unsigned NumArgs;
public:
CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd,
@@ -485,23 +483,11 @@
SourceLocation tyBeginLoc, Expr **Args,
unsigned NumArgs, SourceLocation rParenLoc);
- ~CXXTemporaryObjectExpr();
+ ~CXXTemporaryObjectExpr() { }
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
-
- typedef ExprIterator arg_iterator;
- typedef ConstExprIterator const_arg_iterator;
-
- arg_iterator arg_begin() { return Args; }
- arg_iterator arg_end() { return Args + NumArgs; }
- const_arg_iterator arg_begin() const { return Args; }
- const_arg_iterator arg_end() const { return Args + NumArgs; }
-
- unsigned getNumArgs() const { return NumArgs; }
- const CXXConstructorDecl* getConstructor() const { return Constructor; }
-
virtual SourceRange getSourceRange() const {
return SourceRange(TyBeginLoc, RParenLoc);
}
@@ -509,10 +495,6 @@
return T->getStmtClass() == CXXTemporaryObjectExprClass;
}
static bool classof(const CXXTemporaryObjectExpr *) { return true; }
-
- // Iterators
- virtual child_iterator child_begin();
- virtual child_iterator child_end();
};
/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=69981&r1=69980&r2=69981&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Fri Apr 24 12:34:38 2009
@@ -63,14 +63,6 @@
return child_iterator();
}
-// CXXTemporaryObjectExpr
-Stmt::child_iterator CXXTemporaryObjectExpr::child_begin() {
- return child_iterator(Args);
-}
-Stmt::child_iterator CXXTemporaryObjectExpr::child_end() {
- return child_iterator(Args + NumArgs);
-}
-
// CXXZeroInitValueExpr
Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
return child_iterator();
@@ -238,21 +230,9 @@
Expr **Args,
unsigned NumArgs,
SourceLocation rParenLoc)
- : Expr(CXXTemporaryObjectExprClass, writtenTy,
- writtenTy->isDependentType(),
- (writtenTy->isDependentType() ||
- CallExpr::hasAnyValueDependentArguments(Args, NumArgs))),
- TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc),
- Constructor(Cons), Args(0), NumArgs(NumArgs) {
- if (NumArgs > 0) {
- this->Args = new Stmt*[NumArgs];
- for (unsigned i = 0; i < NumArgs; ++i)
- this->Args[i] = Args[i];
- }
-}
-
-CXXTemporaryObjectExpr::~CXXTemporaryObjectExpr() {
- delete [] Args;
+ : CXXConstructExpr(C, CXXTemporaryObjectExprClass, vd, writtenTy, Cons,
+ false, Args, NumArgs),
+ TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {
}
CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, VarDecl *VD,
More information about the cfe-commits
mailing list