[cfe-commits] r75315 - in /cfe/trunk/lib/Sema: Sema.h SemaExprCXX.cpp

Anders Carlsson andersca at mac.com
Fri Jul 10 16:48:21 PDT 2009


Author: andersca
Date: Fri Jul 10 18:48:10 2009
New Revision: 75315

URL: http://llvm.org/viewvc/llvm-project?rev=75315&view=rev
Log:
Remove some unused code from an experiment that I didn't like.

Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaExprCXX.cpp

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=75315&r1=75314&r2=75315&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Fri Jul 10 18:48:10 2009
@@ -1650,17 +1650,6 @@
   /// 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.

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=75315&r1=75314&r2=75315&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jul 10 18:48:10 2009
@@ -1579,47 +1579,6 @@
   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!");





More information about the cfe-commits mailing list