[cfe-commits] r113627 - in /cfe/trunk: include/clang/AST/ExprCXX.h include/clang/Serialization/ASTBitCodes.h lib/Checker/GRExprEngine.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Fri Sep 10 13:55:54 PDT 2010
Author: cornedbee
Date: Fri Sep 10 15:55:54 2010
New Revision: 113627
URL: http://llvm.org/viewvc/llvm-project?rev=113627&view=rev
Log:
Serialization support for CXXNoexceptExpr.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/Checker/GRExprEngine.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=113627&r1=113626&r2=113627&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Fri Sep 10 15:55:54 2010
@@ -2443,16 +2443,23 @@
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;
Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=113627&r1=113626&r2=113627&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Fri Sep 10 15:55:54 2010
@@ -887,15 +887,16 @@
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
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=113627&r1=113626&r2=113627&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Fri Sep 10 15:55:54 2010
@@ -781,6 +781,7 @@
case Stmt::UnaryTypeTraitExprClass:
case Stmt::UnresolvedLookupExprClass:
case Stmt::UnresolvedMemberExprClass:
+ case Stmt::CXXNoexceptExprClass:
{
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
Builder->BuildSinks = true;
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=113627&r1=113626&r2=113627&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Fri Sep 10 15:55:54 2010
@@ -156,6 +156,7 @@
void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
void VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
+ void VisitCXXNoexceptExpr(CXXNoexceptExpr *E);
};
}
@@ -1252,6 +1253,13 @@
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 @@
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.
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=113627&r1=113626&r2=113627&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Fri Sep 10 15:55:54 2010
@@ -152,6 +152,7 @@
void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
void VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
+ void VisitCXXNoexceptExpr(CXXNoexceptExpr *E);
};
}
@@ -1283,6 +1284,14 @@
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
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list