forked from OSchip/llvm-project
Make CXXTemporaryObjectExpr inherit from CXXConstructExpr.
llvm-svn: 69981
This commit is contained in:
parent
1dcb32260a
commit
95c56ebfb5
|
@ -389,12 +389,12 @@ class CXXConstructExpr : public Expr {
|
||||||
Stmt **Args;
|
Stmt **Args;
|
||||||
unsigned NumArgs;
|
unsigned NumArgs;
|
||||||
|
|
||||||
~CXXConstructExpr() { }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CXXConstructExpr(ASTContext &C, StmtClass SC, VarDecl *vd, QualType T,
|
CXXConstructExpr(ASTContext &C, StmtClass SC, VarDecl *vd, QualType T,
|
||||||
CXXConstructorDecl *d, bool elidable,
|
CXXConstructorDecl *d, bool elidable,
|
||||||
Expr **args, unsigned numargs);
|
Expr **args, unsigned numargs);
|
||||||
|
~CXXConstructExpr() { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CXXConstructExpr *Create(ASTContext &C, VarDecl *VD, QualType T,
|
static CXXConstructExpr *Create(ASTContext &C, VarDecl *VD, QualType T,
|
||||||
|
@ -419,7 +419,8 @@ public:
|
||||||
virtual SourceRange getSourceRange() const { return SourceRange(); }
|
virtual SourceRange getSourceRange() const { return SourceRange(); }
|
||||||
|
|
||||||
static bool classof(const Stmt *T) {
|
static bool classof(const Stmt *T) {
|
||||||
return T->getStmtClass() == CXXConstructExprClass;
|
return T->getStmtClass() == CXXConstructExprClass ||
|
||||||
|
T->getStmtClass() == CXXTemporaryObjectExprClass;
|
||||||
}
|
}
|
||||||
static bool classof(const CXXConstructExpr *) { return true; }
|
static bool classof(const CXXConstructExpr *) { return true; }
|
||||||
|
|
||||||
|
@ -472,12 +473,9 @@ public:
|
||||||
/// return X(1, 3.14f); // creates a CXXTemporaryObjectExpr
|
/// return X(1, 3.14f); // creates a CXXTemporaryObjectExpr
|
||||||
/// };
|
/// };
|
||||||
/// @endcode
|
/// @endcode
|
||||||
class CXXTemporaryObjectExpr : public Expr {
|
class CXXTemporaryObjectExpr : public CXXConstructExpr {
|
||||||
SourceLocation TyBeginLoc;
|
SourceLocation TyBeginLoc;
|
||||||
SourceLocation RParenLoc;
|
SourceLocation RParenLoc;
|
||||||
CXXConstructorDecl *Constructor;
|
|
||||||
Stmt **Args;
|
|
||||||
unsigned NumArgs;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd,
|
CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd,
|
||||||
|
@ -485,23 +483,11 @@ public:
|
||||||
SourceLocation tyBeginLoc, Expr **Args,
|
SourceLocation tyBeginLoc, Expr **Args,
|
||||||
unsigned NumArgs, SourceLocation rParenLoc);
|
unsigned NumArgs, SourceLocation rParenLoc);
|
||||||
|
|
||||||
~CXXTemporaryObjectExpr();
|
~CXXTemporaryObjectExpr() { }
|
||||||
|
|
||||||
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
|
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
|
||||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
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 {
|
virtual SourceRange getSourceRange() const {
|
||||||
return SourceRange(TyBeginLoc, RParenLoc);
|
return SourceRange(TyBeginLoc, RParenLoc);
|
||||||
}
|
}
|
||||||
|
@ -509,10 +495,6 @@ public:
|
||||||
return T->getStmtClass() == CXXTemporaryObjectExprClass;
|
return T->getStmtClass() == CXXTemporaryObjectExprClass;
|
||||||
}
|
}
|
||||||
static bool classof(const CXXTemporaryObjectExpr *) { return true; }
|
static bool classof(const CXXTemporaryObjectExpr *) { return true; }
|
||||||
|
|
||||||
// Iterators
|
|
||||||
virtual child_iterator child_begin();
|
|
||||||
virtual child_iterator child_end();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
|
/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
|
||||||
|
|
|
@ -63,14 +63,6 @@ Stmt::child_iterator CXXDefaultArgExpr::child_end() {
|
||||||
return child_iterator();
|
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
|
// CXXZeroInitValueExpr
|
||||||
Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
|
Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
|
||||||
return child_iterator();
|
return child_iterator();
|
||||||
|
@ -238,21 +230,9 @@ CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C, VarDecl *vd,
|
||||||
Expr **Args,
|
Expr **Args,
|
||||||
unsigned NumArgs,
|
unsigned NumArgs,
|
||||||
SourceLocation rParenLoc)
|
SourceLocation rParenLoc)
|
||||||
: Expr(CXXTemporaryObjectExprClass, writtenTy,
|
: CXXConstructExpr(C, CXXTemporaryObjectExprClass, vd, writtenTy, Cons,
|
||||||
writtenTy->isDependentType(),
|
false, Args, NumArgs),
|
||||||
(writtenTy->isDependentType() ||
|
TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {
|
||||||
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 *CXXConstructExpr::Create(ASTContext &C, VarDecl *VD,
|
CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, VarDecl *VD,
|
||||||
|
|
Loading…
Reference in New Issue