[cfe-commits] r112868 - in /cfe/trunk: include/clang/AST/ExprCXX.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/StmtNodes.td include/clang/Serialization/ASTBitCodes.h lib/AST/ExprCXX.cpp lib/AST/ExprConstant.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Checker/GRExprEngine.cpp lib/CodeGen/Mangle.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp tools/libclang/CXCursor.cpp
Douglas Gregor
dgregor at apple.com
Thu Sep 2 14:50:03 PDT 2010
Author: dgregor
Date: Thu Sep 2 16:50:02 2010
New Revision: 112868
URL: http://llvm.org/viewvc/llvm-project?rev=112868&view=rev
Log:
Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/StmtNodes.td
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Checker/GRExprEngine.cpp
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/tools/libclang/CXCursor.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Sep 2 16:50:02 2010
@@ -631,69 +631,6 @@
virtual child_iterator child_end();
};
-/// CXXBindReferenceExpr - Represents binding an expression to a reference.
-/// In the example:
-///
-/// const int &i = 10;
-///
-/// a bind reference expression is inserted to indicate that 10 is bound to
-/// a reference, and that a temporary needs to be created to hold the
-/// value.
-class CXXBindReferenceExpr : public Expr {
- // SubExpr - The expression being bound.
- Stmt *SubExpr;
-
- // ExtendsLifetime - Whether binding this reference extends the lifetime of
- // the expression being bound. FIXME: Add C++ reference.
- bool ExtendsLifetime;
-
- /// RequiresTemporaryCopy - Whether binding the subexpression requires a
- /// temporary copy.
- bool RequiresTemporaryCopy;
-
- CXXBindReferenceExpr(Expr *subexpr, bool ExtendsLifetime,
- bool RequiresTemporaryCopy)
- : Expr(CXXBindReferenceExprClass, subexpr->getType(), false, false),
- SubExpr(subexpr), ExtendsLifetime(ExtendsLifetime),
- RequiresTemporaryCopy(RequiresTemporaryCopy) { }
-
-public:
- static CXXBindReferenceExpr *Create(ASTContext &C, Expr *SubExpr,
- bool ExtendsLifetime,
- bool RequiresTemporaryCopy);
-
- explicit CXXBindReferenceExpr(EmptyShell Empty)
- : Expr(CXXBindReferenceExprClass, Empty) { }
-
- const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
- Expr *getSubExpr() { return cast<Expr>(SubExpr); }
- void setSubExpr(Expr *E) { SubExpr = E; }
-
- virtual SourceRange getSourceRange() const {
- return SubExpr->getSourceRange();
- }
-
- /// requiresTemporaryCopy - Whether binding the subexpression requires a
- /// temporary copy.
- bool requiresTemporaryCopy() const { return RequiresTemporaryCopy; }
-
- // extendsLifetime - Whether binding this reference extends the lifetime of
- // the expression being bound. FIXME: Add C++ reference.
- bool extendsLifetime() const { return ExtendsLifetime; }
-
- // Implement isa/cast/dyncast/etc.
- static bool classof(const Stmt *T) {
- return T->getStmtClass() == CXXBindReferenceExprClass;
- }
- static bool classof(const CXXBindReferenceExpr *) { return true; }
-
- // Iterators
- virtual child_iterator child_begin();
- virtual child_iterator child_end();
-
- friend class ASTStmtReader;
-};
-
/// CXXConstructExpr - Represents a call to a C++ constructor.
class CXXConstructExpr : public Expr {
public:
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu Sep 2 16:50:02 2010
@@ -1786,7 +1786,6 @@
DEF_TRAVERSE_STMT(BlockExpr, { })
DEF_TRAVERSE_STMT(ChooseExpr, { })
DEF_TRAVERSE_STMT(CompoundLiteralExpr, { })
-DEF_TRAVERSE_STMT(CXXBindReferenceExpr, { })
DEF_TRAVERSE_STMT(CXXBindTemporaryExpr, { })
DEF_TRAVERSE_STMT(CXXBoolLiteralExpr, { })
DEF_TRAVERSE_STMT(CXXDefaultArgExpr, { })
Modified: cfe/trunk/include/clang/Basic/StmtNodes.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/StmtNodes.td (original)
+++ cfe/trunk/include/clang/Basic/StmtNodes.td Thu Sep 2 16:50:02 2010
@@ -103,7 +103,6 @@
def DependentScopeDeclRefExpr : DStmt<Expr>;
def CXXConstructExpr : DStmt<Expr>;
def CXXBindTemporaryExpr : DStmt<Expr>;
-def CXXBindReferenceExpr : DStmt<Expr>;
def CXXExprWithTemporaries : DStmt<Expr>;
def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>;
def CXXUnresolvedConstructExpr : DStmt<Expr>;
Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Thu Sep 2 16:50:02 2010
@@ -879,7 +879,6 @@
EXPR_CXX_THROW, // CXXThrowExpr
EXPR_CXX_DEFAULT_ARG, // CXXDefaultArgExpr
EXPR_CXX_BIND_TEMPORARY, // CXXBindTemporaryExpr
- EXPR_CXX_BIND_REFERENCE, // CXXBindReferenceExpr
EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
EXPR_CXX_NEW, // CXXNewExpr
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Thu Sep 2 16:50:02 2010
@@ -677,14 +677,6 @@
return new (C) CXXBindTemporaryExpr(Temp, SubExpr);
}
-CXXBindReferenceExpr *CXXBindReferenceExpr::Create(ASTContext &C, Expr *SubExpr,
- bool ExtendsLifetime,
- bool RequiresTemporaryCopy) {
- return new (C) CXXBindReferenceExpr(SubExpr,
- ExtendsLifetime,
- RequiresTemporaryCopy);
-}
-
CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C,
CXXConstructorDecl *Cons,
QualType writtenTy,
@@ -770,15 +762,6 @@
return &SubExpr + 1;
}
-// CXXBindReferenceExpr
-Stmt::child_iterator CXXBindReferenceExpr::child_begin() {
- return &SubExpr;
-}
-
-Stmt::child_iterator CXXBindReferenceExpr::child_end() {
- return &SubExpr + 1;
-}
-
// CXXConstructExpr
Stmt::child_iterator CXXConstructExpr::child_begin() {
return &Args[0];
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Sep 2 16:50:02 2010
@@ -2387,7 +2387,6 @@
case Expr::DependentScopeDeclRefExprClass:
case Expr::CXXConstructExprClass:
case Expr::CXXBindTemporaryExprClass:
- case Expr::CXXBindReferenceExprClass:
case Expr::CXXExprWithTemporariesClass:
case Expr::CXXTemporaryObjectExprClass:
case Expr::CXXUnresolvedConstructExprClass:
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Thu Sep 2 16:50:02 2010
@@ -1037,10 +1037,6 @@
PrintExpr(Node->getSubExpr());
}
-void StmtPrinter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *Node) {
- PrintExpr(Node->getSubExpr());
-}
-
void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
OS << Node->getType().getAsString(Policy);
OS << "(";
Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Thu Sep 2 16:50:02 2010
@@ -706,10 +706,6 @@
const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
}
-void StmtProfiler::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *S) {
- VisitExpr(S);
-}
-
void StmtProfiler::VisitCXXConstructExpr(CXXConstructExpr *S) {
VisitExpr(S);
VisitDecl(S->getConstructor());
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Thu Sep 2 16:50:02 2010
@@ -761,7 +761,6 @@
switch (S->getStmtClass()) {
// C++ stuff we don't support yet.
- case Stmt::CXXBindReferenceExprClass:
case Stmt::CXXBindTemporaryExprClass:
case Stmt::CXXCatchStmtClass:
case Stmt::CXXConstructExprClass:
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Thu Sep 2 16:50:02 2010
@@ -1906,10 +1906,6 @@
break;
}
- case Expr::CXXBindReferenceExprClass:
- mangleExpression(cast<CXXBindReferenceExpr>(E)->getSubExpr());
- break;
-
case Expr::CXXBindTemporaryExprClass:
mangleExpression(cast<CXXBindTemporaryExpr>(E)->getSubExpr());
break;
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Sep 2 16:50:02 2010
@@ -5695,16 +5695,6 @@
return getDerived().TransformExpr(E->getSubExpr());
}
-/// \brief Transform a C++ reference-binding expression.
-///
-/// Since CXXBindReferenceExpr nodes are implicitly generated, we just
-/// transform the subexpression and return that.
-template<typename Derived>
-ExprResult
-TreeTransform<Derived>::TransformCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
- return getDerived().TransformExpr(E->getSubExpr());
-}
-
/// \brief Transform a C++ expression that contains temporaries that should
/// be destroyed after the expression is evaluated.
///
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Thu Sep 2 16:50:02 2010
@@ -138,7 +138,6 @@
void VisitCXXThrowExpr(CXXThrowExpr *E);
void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E);
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E);
- void VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E);
void VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
void VisitCXXNewExpr(CXXNewExpr *E);
@@ -1057,13 +1056,6 @@
E->setSubExpr(Reader.ReadSubExpr());
}
-void ASTStmtReader::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
- VisitExpr(E);
- E->SubExpr = Reader.ReadSubExpr();
- E->ExtendsLifetime = Record[Idx++];
- E->RequiresTemporaryCopy = Record[Idx++];
-}
-
void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
VisitExpr(E);
E->setTypeBeginLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
@@ -1704,10 +1696,7 @@
case EXPR_CXX_BIND_TEMPORARY:
S = new (Context) CXXBindTemporaryExpr(Empty);
break;
- case EXPR_CXX_BIND_REFERENCE:
- S = new (Context) CXXBindReferenceExpr(Empty);
- break;
-
+
case EXPR_CXX_SCALAR_VALUE_INIT:
S = new (Context) CXXScalarValueInitExpr(Empty);
break;
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Thu Sep 2 16:50:02 2010
@@ -135,7 +135,6 @@
void VisitCXXThrowExpr(CXXThrowExpr *E);
void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E);
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E);
- void VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E);
void VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
void VisitCXXNewExpr(CXXNewExpr *E);
@@ -1075,14 +1074,6 @@
Code = serialization::EXPR_CXX_BIND_TEMPORARY;
}
-void ASTStmtWriter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
- VisitExpr(E);
- Writer.AddStmt(E->getSubExpr());
- Record.push_back(E->extendsLifetime());
- Record.push_back(E->requiresTemporaryCopy());
- Code = serialization::EXPR_CXX_BIND_REFERENCE;
-}
-
void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Modified: cfe/trunk/tools/libclang/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=112868&r1=112867&r2=112868&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)
+++ cfe/trunk/tools/libclang/CXCursor.cpp Thu Sep 2 16:50:02 2010
@@ -201,7 +201,6 @@
case Stmt::UnaryTypeTraitExprClass:
case Stmt::DependentScopeDeclRefExprClass:
case Stmt::CXXBindTemporaryExprClass:
- case Stmt::CXXBindReferenceExprClass:
case Stmt::CXXExprWithTemporariesClass:
case Stmt::CXXUnresolvedConstructExprClass:
case Stmt::CXXDependentScopeMemberExprClass:
More information about the cfe-commits
mailing list