зеркало из https://github.com/microsoft/clang-1.git
Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112868 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
da135b14ad
Коммит
e2ca6d4a2f
|
@ -631,69 +631,6 @@ public:
|
|||
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:
|
||||
|
|
|
@ -1786,7 +1786,6 @@ DEF_TRAVERSE_STMT(BlockDeclRefExpr, { })
|
|||
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, { })
|
||||
|
|
|
@ -103,7 +103,6 @@ def UnaryTypeTraitExpr : DStmt<Expr>;
|
|||
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>;
|
||||
|
|
|
@ -879,7 +879,6 @@ namespace clang {
|
|||
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
|
||||
|
|
|
@ -677,14 +677,6 @@ CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C,
|
|||
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 @@ Stmt::child_iterator CXXBindTemporaryExpr::child_end() {
|
|||
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];
|
||||
|
|
|
@ -2387,7 +2387,6 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
|
|||
case Expr::DependentScopeDeclRefExprClass:
|
||||
case Expr::CXXConstructExprClass:
|
||||
case Expr::CXXBindTemporaryExprClass:
|
||||
case Expr::CXXBindReferenceExprClass:
|
||||
case Expr::CXXExprWithTemporariesClass:
|
||||
case Expr::CXXTemporaryObjectExprClass:
|
||||
case Expr::CXXUnresolvedConstructExprClass:
|
||||
|
|
|
@ -1037,10 +1037,6 @@ void StmtPrinter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
|
|||
PrintExpr(Node->getSubExpr());
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *Node) {
|
||||
PrintExpr(Node->getSubExpr());
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
|
||||
OS << Node->getType().getAsString(Policy);
|
||||
OS << "(";
|
||||
|
|
|
@ -706,10 +706,6 @@ void StmtProfiler::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *S) {
|
|||
const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *S) {
|
||||
VisitExpr(S);
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitCXXConstructExpr(CXXConstructExpr *S) {
|
||||
VisitExpr(S);
|
||||
VisitDecl(S->getConstructor());
|
||||
|
|
|
@ -761,7 +761,6 @@ void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
|||
|
||||
switch (S->getStmtClass()) {
|
||||
// C++ stuff we don't support yet.
|
||||
case Stmt::CXXBindReferenceExprClass:
|
||||
case Stmt::CXXBindTemporaryExprClass:
|
||||
case Stmt::CXXCatchStmtClass:
|
||||
case Stmt::CXXConstructExprClass:
|
||||
|
|
|
@ -1906,10 +1906,6 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
|
|||
break;
|
||||
}
|
||||
|
||||
case Expr::CXXBindReferenceExprClass:
|
||||
mangleExpression(cast<CXXBindReferenceExpr>(E)->getSubExpr());
|
||||
break;
|
||||
|
||||
case Expr::CXXBindTemporaryExprClass:
|
||||
mangleExpression(cast<CXXBindTemporaryExpr>(E)->getSubExpr());
|
||||
break;
|
||||
|
|
|
@ -5695,16 +5695,6 @@ TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
|||
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.
|
||||
///
|
||||
|
|
|
@ -138,7 +138,6 @@ namespace clang {
|
|||
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 @@ void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
|||
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,9 +1696,6 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
|||
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);
|
||||
|
|
|
@ -135,7 +135,6 @@ namespace clang {
|
|||
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 @@ void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
|||
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);
|
||||
|
|
|
@ -201,7 +201,6 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, ASTUnit *TU) {
|
|||
case Stmt::UnaryTypeTraitExprClass:
|
||||
case Stmt::DependentScopeDeclRefExprClass:
|
||||
case Stmt::CXXBindTemporaryExprClass:
|
||||
case Stmt::CXXBindReferenceExprClass:
|
||||
case Stmt::CXXExprWithTemporariesClass:
|
||||
case Stmt::CXXUnresolvedConstructExprClass:
|
||||
case Stmt::CXXDependentScopeMemberExprClass:
|
||||
|
|
Загрузка…
Ссылка в новой задаче