forked from OSchip/llvm-project
Serialization support for CXXNoexceptExpr.
llvm-svn: 113627
This commit is contained in:
parent
ba1a68bbc3
commit
9ac55dd8e4
|
@ -2443,16 +2443,23 @@ class CXXNoexceptExpr : public Expr {
|
|||
public:
|
||||
CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val,
|
||||
SourceLocation Keyword, SourceLocation RParen)
|
||||
: Expr(CXXNoexceptExprClass, Ty, /*TypeDependent*/false,
|
||||
/*ValueDependent*/Val == CT_Dependent),
|
||||
Value(Val == CT_Cannot), Operand(Operand), Range(Keyword, RParen)
|
||||
: Expr(CXXNoexceptExprClass, Ty, /*TypeDependent*/false,
|
||||
/*ValueDependent*/Val == CT_Dependent),
|
||||
Value(Val == CT_Cannot), Operand(Operand), Range(Keyword, RParen)
|
||||
{ }
|
||||
|
||||
CXXNoexceptExpr(EmptyShell Empty)
|
||||
: Expr(CXXNoexceptExprClass, Empty)
|
||||
{ }
|
||||
|
||||
Expr *getOperand() const { return static_cast<Expr*>(Operand); }
|
||||
void setOperand(Expr *E) { Operand = E; }
|
||||
|
||||
virtual SourceRange getSourceRange() const { return Range; }
|
||||
void setSourceRange(const SourceRange &R) { Range = R; }
|
||||
|
||||
bool getValue() const { return Value; }
|
||||
void setValue(bool V) { Value = V; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXNoexceptExprClass;
|
||||
|
|
|
@ -887,15 +887,16 @@ namespace clang {
|
|||
EXPR_CXX_DELETE, // CXXDeleteExpr
|
||||
EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
|
||||
|
||||
EXPR_CXX_EXPR_WITH_TEMPORARIES, // CXXExprWithTemporaries
|
||||
EXPR_CXX_EXPR_WITH_TEMPORARIES, // CXXExprWithTemporaries
|
||||
|
||||
EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
|
||||
EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
|
||||
EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
|
||||
EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
|
||||
EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
|
||||
EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
|
||||
EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
|
||||
EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
|
||||
EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
|
||||
EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
|
||||
|
||||
EXPR_CXX_UNARY_TYPE_TRAIT // UnaryTypeTraitExpr
|
||||
EXPR_CXX_UNARY_TYPE_TRAIT, // UnaryTypeTraitExpr
|
||||
EXPR_CXX_NOEXCEPT // CXXNoexceptExpr
|
||||
};
|
||||
|
||||
/// \brief The kinds of designators that can occur in a
|
||||
|
|
|
@ -781,6 +781,7 @@ void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
|||
case Stmt::UnaryTypeTraitExprClass:
|
||||
case Stmt::UnresolvedLookupExprClass:
|
||||
case Stmt::UnresolvedMemberExprClass:
|
||||
case Stmt::CXXNoexceptExprClass:
|
||||
{
|
||||
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
|
||||
Builder->BuildSinks = true;
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace clang {
|
|||
void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
|
||||
|
||||
void VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
|
||||
void VisitCXXNoexceptExpr(CXXNoexceptExpr *E);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1252,6 +1253,13 @@ void ASTStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
|
|||
E->QueriedType = Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
||||
VisitExpr(E);
|
||||
E->setValue((bool)Record[Idx++]);
|
||||
E->setSourceRange(Reader.ReadSourceRange(Record, Idx));
|
||||
E->setOperand(Reader.ReadSubExpr());
|
||||
}
|
||||
|
||||
Stmt *ASTReader::ReadStmt(llvm::BitstreamCursor &Cursor) {
|
||||
switch (ReadingKind) {
|
||||
case Read_Decl:
|
||||
|
@ -1764,6 +1772,10 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
|||
case EXPR_CXX_UNARY_TYPE_TRAIT:
|
||||
S = new (Context) UnaryTypeTraitExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_NOEXCEPT:
|
||||
S = new (Context) CXXNoexceptExpr(Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
// We hit a STMT_STOP, so we're done with this expression.
|
||||
|
|
|
@ -152,6 +152,7 @@ namespace clang {
|
|||
void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
|
||||
|
||||
void VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
|
||||
void VisitCXXNoexceptExpr(CXXNoexceptExpr *E);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1283,6 +1284,14 @@ void ASTStmtWriter::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
|
|||
Code = serialization::EXPR_CXX_UNARY_TYPE_TRAIT;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
||||
VisitExpr(E);
|
||||
Record.push_back(E->getValue());
|
||||
Writer.AddSourceRange(E->getSourceRange(), Record);
|
||||
Writer.AddStmt(E->getOperand());
|
||||
Code = serialization::EXPR_CXX_NOEXCEPT;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ASTWriter Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue