explicit PredefinedExpr(EmptyShell Empty)
: Expr(PredefinedExprClass, Empty) { }
- PredefinedExpr* Clone(ASTContext &C) const;
-
IdentType getIdentType() const { return Type; }
void setIdentType(IdentType IT) { Type = IT; }
explicit IntegerLiteral(EmptyShell Empty)
: Expr(IntegerLiteralClass, Empty) { }
- IntegerLiteral* Clone(ASTContext &C) const;
-
const llvm::APInt &getValue() const { return Value; }
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
/// \brief Construct an empty character literal.
CharacterLiteral(EmptyShell Empty) : Expr(CharacterLiteralClass, Empty) { }
- CharacterLiteral* Clone(ASTContext &C) const;
-
SourceLocation getLoc() const { return Loc; }
bool isWide() const { return IsWide; }
explicit FloatingLiteral(EmptyShell Empty)
: Expr(FloatingLiteralClass, Empty), Value(0.0) { }
- FloatingLiteral* Clone(ASTContext &C) const;
-
const llvm::APFloat &getValue() const { return Value; }
void setValue(const llvm::APFloat &Val) { Value = Val; }
Expr *getSubExpr() { return cast<Expr>(Val); }
void setSubExpr(Expr *E) { Val = E; }
- ImaginaryLiteral* Clone(ASTContext &C) const;
-
virtual SourceRange getSourceRange() const { return Val->getSourceRange(); }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ImaginaryLiteralClass;
/// \brief Construct an empty string literal.
static StringLiteral *CreateEmpty(ASTContext &C, unsigned NumStrs);
- StringLiteral* Clone(ASTContext &C) const;
-
const char *getStrData() const { return StrData; }
unsigned getByteLength() const { return ByteLength; }
/// \brief Build an empty GNU __null expression.
explicit GNUNullExpr(EmptyShell Empty) : Expr(GNUNullExprClass, Empty) { }
- GNUNullExpr* Clone(ASTContext &C) const;
-
/// getTokenLocation - The location of the __null token.
SourceLocation getTokenLocation() const { return TokenLoc; }
void setTokenLocation(SourceLocation L) { TokenLoc = L; }
return SourceRange();
}
- ImplicitValueInitExpr *Clone(ASTContext &C) const;
-
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) :
Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {}
- CXXBoolLiteralExpr* Clone(ASTContext &C) const;
-
bool getValue() const { return Value; }
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
CXXNullPtrLiteralExpr(QualType Ty, SourceLocation l) :
Expr(CXXNullPtrLiteralExprClass, Ty), Loc(l) {}
- CXXNullPtrLiteralExpr* Clone(ASTContext &C) const;
-
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
static bool classof(const Stmt *T) {
return SourceRange(TyBeginLoc, RParenLoc);
}
- CXXZeroInitValueExpr* Clone(ASTContext &C) const;
-
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXZeroInitValueExprClass;
}
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
- UnresolvedFunctionNameExpr* Clone(ASTContext &C) const;
-
static bool classof(const Stmt *T) {
return T->getStmtClass() == UnresolvedFunctionNameExprClass;
}
explicit ObjCStringLiteral(EmptyShell Empty)
: Expr(ObjCStringLiteralClass, Empty) {}
- ObjCStringLiteral* Clone(ASTContext &C) const;
-
StringLiteral *getString() { return cast<StringLiteral>(String); }
const StringLiteral *getString() const { return cast<StringLiteral>(String); }
void setString(StringLiteral *S) { String = S; }
explicit ObjCSelectorExpr(EmptyShell Empty)
: Expr(ObjCSelectorExprClass, Empty) {}
- ObjCSelectorExpr *Clone(ASTContext &C) const;
-
Selector getSelector() const { return SelName; }
void setSelector(Selector S) { SelName = S; }
explicit ObjCProtocolExpr(EmptyShell Empty)
: Expr(ObjCProtocolExprClass, Empty) {}
- ObjCProtocolExpr *Clone(ASTContext &C) const;
-
ObjCProtocolDecl *getProtocol() const { return TheProtocol; }
void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; }
/// \brief Build an empty null statement.
explicit NullStmt(EmptyShell Empty) : Stmt(NullStmtClass, Empty) { }
- NullStmt* Clone(ASTContext &C) const;
-
SourceLocation getSemiLoc() const { return SemiLoc; }
void setSemiLoc(SourceLocation L) { SemiLoc = L; }
return SourceRange(ContinueLoc);
}
- ContinueStmt* Clone(ASTContext &C) const;
-
static bool classof(const Stmt *T) {
return T->getStmtClass() == ContinueStmtClass;
}
virtual SourceRange getSourceRange() const { return SourceRange(BreakLoc); }
- BreakStmt* Clone(ASTContext &C) const;
-
static bool classof(const Stmt *T) {
return T->getStmtClass() == BreakStmtClass;
}
// Primary Expressions.
//===----------------------------------------------------------------------===//
-PredefinedExpr* PredefinedExpr::Clone(ASTContext &C) const {
- return new (C) PredefinedExpr(Loc, getType(), Type);
-}
-
-IntegerLiteral* IntegerLiteral::Clone(ASTContext &C) const {
- return new (C) IntegerLiteral(Value, getType(), Loc);
-}
-
-CharacterLiteral* CharacterLiteral::Clone(ASTContext &C) const {
- return new (C) CharacterLiteral(Value, IsWide, getType(), Loc);
-}
-
-FloatingLiteral* FloatingLiteral::Clone(ASTContext &C) const {
- return new (C) FloatingLiteral(Value, IsExact, getType(), Loc);
-}
-
-ImaginaryLiteral* ImaginaryLiteral::Clone(ASTContext &C) const {
- // FIXME: Use virtual Clone(), once it is available
- Expr *ClonedVal = 0;
- if (const IntegerLiteral *IntLit = dyn_cast<IntegerLiteral>(Val))
- ClonedVal = IntLit->Clone(C);
- else
- ClonedVal = cast<FloatingLiteral>(Val)->Clone(C);
- return new (C) ImaginaryLiteral(ClonedVal, getType());
-}
-
-GNUNullExpr* GNUNullExpr::Clone(ASTContext &C) const {
- return new (C) GNUNullExpr(getType(), TokenLoc);
-}
-
/// getValueAsApproximateDouble - This returns the value as an inaccurate
/// double. Note that this may cause loss of precision, but is useful for
/// debugging dumps, etc.
return SL;
}
-StringLiteral* StringLiteral::Clone(ASTContext &C) const {
- return Create(C, StrData, ByteLength, IsWide, getType(),
- TokLocs, NumConcatenated);
-}
-
void StringLiteral::DoDestroy(ASTContext &C) {
C.Deallocate(const_cast<char*>(StrData));
Expr::DoDestroy(C);
RBracloc = RBrac;
}
-ObjCStringLiteral* ObjCStringLiteral::Clone(ASTContext &C) const {
- // Clone the string literal.
- StringLiteral *NewString =
- String ? cast<StringLiteral>(String)->Clone(C) : 0;
-
- return new (C) ObjCStringLiteral(NewString, getType(), AtLoc);
-}
-
-ObjCSelectorExpr *ObjCSelectorExpr::Clone(ASTContext &C) const {
- return new (C) ObjCSelectorExpr(getType(), SelName, AtLoc, RParenLoc);
-}
-
-ObjCProtocolExpr *ObjCProtocolExpr::Clone(ASTContext &C) const {
- return new (C) ObjCProtocolExpr(getType(), TheProtocol, AtLoc, RParenLoc);
-}
-
// constructor for class messages.
// FIXME: clsName should be typed to ObjCInterfaceType
ObjCMessageExpr::ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
Expr::DoDestroy(C);
}
-ImplicitValueInitExpr *ImplicitValueInitExpr::Clone(ASTContext &C) const {
- return new (C) ImplicitValueInitExpr(getType());
-}
-
//===----------------------------------------------------------------------===//
// ExprIterator.
//===----------------------------------------------------------------------===//
Stmt::child_iterator UnresolvedFunctionNameExpr::child_end() {
return child_iterator();
}
-
-UnresolvedFunctionNameExpr*
-UnresolvedFunctionNameExpr::Clone(ASTContext &C) const {
- return new (C) UnresolvedFunctionNameExpr(Name, getType(), Loc);
-}
-
// UnaryTypeTraitExpr
Stmt::child_iterator UnaryTypeTraitExpr::child_begin() {
return child_iterator();
Stmt::child_iterator CXXUnresolvedMemberExpr::child_end() {
return child_iterator(&Base + 1);
}
-
-//===----------------------------------------------------------------------===//
-// Cloners
-//===----------------------------------------------------------------------===//
-
-CXXBoolLiteralExpr* CXXBoolLiteralExpr::Clone(ASTContext &C) const {
- return new (C) CXXBoolLiteralExpr(Value, getType(), Loc);
-}
-
-CXXNullPtrLiteralExpr* CXXNullPtrLiteralExpr::Clone(ASTContext &C) const {
- return new (C) CXXNullPtrLiteralExpr(getType(), Loc);
-}
-
-CXXZeroInitValueExpr* CXXZeroInitValueExpr::Clone(ASTContext &C) const {
- return new (C) CXXZeroInitValueExpr(getType(), TyBeginLoc, RParenLoc);
-}
return StatSwitch;
}
-NullStmt* NullStmt::Clone(ASTContext &C) const {
- return new (C) NullStmt(SemiLoc);
-}
-
-ContinueStmt* ContinueStmt::Clone(ASTContext &C) const {
- return new (C) ContinueStmt(ContinueLoc);
-}
-
-BreakStmt* BreakStmt::Clone(ASTContext &C) const {
- return new (C) BreakStmt(BreakLoc);
-}
-
void SwitchStmt::DoDestroy(ASTContext &Ctx) {
// Destroy the SwitchCase statements in this switch. In the normal
// case, this loop will merely decrement the reference counts from
if (Elt == DSAT->getElementType())
return T;
- // FIXME: Clone expression!
- return Context.getDependentSizedArrayType(Elt, DSAT->getSizeExpr(),
+ return Context.getDependentSizedArrayType(Elt, DSAT->getSizeExpr()->Retain(),
DSAT->getSizeModifier(), 0,
SourceRange());
}
// arguments left unspecified.
if (NTTP->getPosition() >= TemplateArgs.size() ||
TemplateArgs[NTTP->getPosition()].isNull())
- return SemaRef.Owned(E); // FIXME: Clone the expression!
+ return SemaRef.Owned(E->Retain());
const TemplateArgument &Arg = TemplateArgs[NTTP->getPosition()];
}
Sema::OwningStmtResult TemplateStmtInstantiator::VisitNullStmt(NullStmt *S) {
- return SemaRef.Owned(S->Clone(SemaRef.Context));
+ return SemaRef.Owned(S->Retain());
}
Sema::OwningStmtResult TemplateStmtInstantiator::VisitLabelStmt(LabelStmt *S) {
}
Sema::OwningStmtResult TemplateStmtInstantiator::VisitBreakStmt(BreakStmt *S) {
- return SemaRef.Owned(S->Clone(SemaRef.Context));
+ return SemaRef.Owned(S->Retain());
}
Sema::OwningStmtResult
TemplateStmtInstantiator::VisitContinueStmt(ContinueStmt *S) {
- return SemaRef.Owned(S->Clone(SemaRef.Context));
+ return SemaRef.Owned(S->Retain());
}
Sema::OwningStmtResult