diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 55 | ||||
| -rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 22 | ||||
| -rw-r--r-- | clang/lib/AST/Stmt.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateExpr.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateStmt.cpp | 6 |
6 files changed, 5 insertions, 95 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 0f3cbe18d9e..2c07de6c79a 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -28,36 +28,6 @@ using namespace clang; // 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. @@ -106,11 +76,6 @@ StringLiteral *StringLiteral::CreateEmpty(ASTContext &C, unsigned NumStrs) { 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); @@ -1564,22 +1529,6 @@ ObjCMessageExpr::ObjCMessageExpr(Expr *receiver, Selector selInfo, 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, @@ -1835,10 +1784,6 @@ void DesignatedInitExpr::DoDestroy(ASTContext &C) { Expr::DoDestroy(C); } -ImplicitValueInitExpr *ImplicitValueInitExpr::Clone(ASTContext &C) const { - return new (C) ImplicitValueInitExpr(getType()); -} - //===----------------------------------------------------------------------===// // ExprIterator. //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 67d62a94ece..454dc14b6c8 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -123,12 +123,6 @@ Stmt::child_iterator UnresolvedFunctionNameExpr::child_begin() { 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(); @@ -515,19 +509,3 @@ Stmt::child_iterator CXXUnresolvedMemberExpr::child_begin() { 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); -} diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index a0ef5a64280..cd8fba6b7a1 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -92,18 +92,6 @@ bool Stmt::CollectingStats(bool enable) { 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 diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 7fb159fec7e..b3d370ab12e 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -328,8 +328,7 @@ static QualType getUnqualifiedArrayType(ASTContext &Context, QualType T, 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()); } diff --git a/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp b/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp index 1e97f5fcc46..186c98cf53e 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp @@ -147,7 +147,7 @@ TemplateExprInstantiator::VisitDeclRefExpr(DeclRefExpr *E) { // 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()]; diff --git a/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp b/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp index 565b95b329f..80ff5eb082a 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp @@ -81,7 +81,7 @@ Sema::OwningStmtResult TemplateStmtInstantiator::VisitDeclStmt(DeclStmt *S) { } Sema::OwningStmtResult TemplateStmtInstantiator::VisitNullStmt(NullStmt *S) { - return SemaRef.Owned(S->Clone(SemaRef.Context)); + return SemaRef.Owned(S->Retain()); } Sema::OwningStmtResult TemplateStmtInstantiator::VisitLabelStmt(LabelStmt *S) { @@ -112,12 +112,12 @@ TemplateStmtInstantiator::VisitIndirectGotoStmt(IndirectGotoStmt *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 |

