diff options
author | Anders Carlsson <andersca@mac.com> | 2009-07-10 23:48:10 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-07-10 23:48:10 +0000 |
commit | 771d7c374327d8f55a77431d78eae7b89f16a499 (patch) | |
tree | 256a8613c8feb9a4c3b0c39063b31b367e716e0c | |
parent | 14108da7f7fc059772711e4ffee1322a27b152a7 (diff) |
Remove some unused code from an experiment that I didn't like.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75315 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/Sema.h | 11 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 41 |
2 files changed, 0 insertions, 52 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 10ea5146a0..9eb03e36b4 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1650,17 +1650,6 @@ public: /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise /// it simply returns the passed in expression. OwningExprResult MaybeBindToTemporary(Expr *E); - - /// RemoveOutermostTemporaryBinding - Remove and destroy the outermost - /// CXXBindToTemporaryExpr if necessary. This is used when we want to not - /// destroy a temporary when a full expression has been evaluated. - /// For example: - /// - /// const T& t = T(10, T()); - /// - /// Here the outermost T needs to be destroyed when t goes out of scope, but - /// the innermost T needs to be destroyed when the expr has been evaluated. - Expr *RemoveOutermostTemporaryBinding(Expr *E); /// InitializationKind - Represents which kind of C++ initialization /// [dcl.init] a routine is to perform. diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index d522bf29dc..ac3afa8b75 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1579,47 +1579,6 @@ Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) { return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E)); } -// FIXME: This doesn't handle casts yet. -Expr *Sema::RemoveOutermostTemporaryBinding(Expr *E) { - const RecordType *RT = E->getType()->getAsRecordType(); - if (!RT) - return E; - - CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()); - if (RD->hasTrivialDestructor()) - return E; - - /// The expr passed in must be a CXXExprWithTemporaries. - CXXExprWithTemporaries *TempExpr = dyn_cast<CXXExprWithTemporaries>(E); - if (!TempExpr) - return E; - - Expr *SubExpr = TempExpr->getSubExpr(); - if (CXXBindTemporaryExpr *BE = dyn_cast<CXXBindTemporaryExpr>(SubExpr)) { - assert(BE->getTemporary() == - TempExpr->getTemporary(TempExpr->getNumTemporaries() - 1) && - "Found temporary is not last in list!"); - - Expr *BindSubExpr = BE->getSubExpr(); - BE->setSubExpr(0); - - if (TempExpr->getNumTemporaries() == 1) { - // There's just one temporary left, so we don't need the TempExpr node. - TempExpr->Destroy(Context); - return BindSubExpr; - } else { - TempExpr->removeLastTemporary(); - TempExpr->setSubExpr(BindSubExpr); - BE->Destroy(Context); - } - - return E; - } - - // FIXME: We might need to handle other expressions here. - return E; -} - Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr, bool ShouldDestroyTemps) { assert(SubExpr && "sub expression can't be null!"); |