diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-10 22:34:40 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-10 22:34:40 +0000 |
commit | 5221d8f2da008689f7ff9476e6522bb2b63ec1a3 (patch) | |
tree | ec4531aef091d60a2e47a4cd93210e403d474c6f | |
parent | fe6834af25d0809215c9e205c9983dd6d3f968b4 (diff) |
Address Doug's comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113650 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/ExprCXX.h | 3 | ||||
-rw-r--r-- | lib/AST/Expr.cpp | 7 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderStmt.cpp | 6 | ||||
-rw-r--r-- | test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp | 4 | ||||
-rw-r--r-- | test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp | 2 |
5 files changed, 13 insertions, 9 deletions
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 4ba0d07e95..1b0a63e32a 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -2441,9 +2441,6 @@ class CXXNoexceptExpr : public Expr { SourceRange Range; friend class ASTStmtReader; - void setOperand(Expr *E) { Operand = E; } - void setSourceRange(const SourceRange &R) { Range = R; } - void setValue(bool V) { Value = V; } public: CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val, diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 435f7548ea..65dafae35e 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1347,6 +1347,11 @@ static Expr::CanThrowResult CanCalleeThrow(const Decl *D, if (!VD) // If we have no clue what we're calling, assume the worst. return Expr::CT_Can; + // As an extension, we assume that __attribute__((nothrow)) functions don't + // throw. + if (isa<FunctionDecl>(D) && D->hasAttr<NoThrowAttr>()) + return Expr::CT_Cannot; + QualType T = VD->getType(); const FunctionProtoType *FT; if ((FT = T->getAs<FunctionProtoType>())) { @@ -1482,7 +1487,7 @@ Expr::CanThrowResult Expr::CanThrow(ASTContext &C) const { case VAArgExprClass: case CXXDefaultArgExprClass: case CXXBindTemporaryExprClass: - case CXXExprWithTemporariesClass: + case CXXExprWithTemporariesClass: // FIXME: this thing calls destructors case ObjCIvarRefExprClass: case ObjCIsaExprClass: case ShuffleVectorExprClass: diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index 0449a98930..c2b054b1f8 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -1255,9 +1255,9 @@ void ASTStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) { VisitExpr(E); - E->setValue((bool)Record[Idx++]); - E->setSourceRange(Reader.ReadSourceRange(Record, Idx)); - E->setOperand(Reader.ReadSubExpr()); + E->Value = (bool)Record[Idx++]; + E->Range = Reader.ReadSourceRange(Record, Idx); + E->Operand = Reader.ReadSubExpr(); } Stmt *ASTReader::ReadStmt(llvm::BitstreamCursor &Cursor) { diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp index aa2d553542..e7a8b1e47f 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp @@ -11,9 +11,9 @@ struct E { void test() { bool b; - // CHECK: store i8 1, i8* %b, align 1 + // CHECK: store i8 1 b = noexcept(0); - // CHECK: store i8 0, i8* %b, align 1 + // CHECK: store i8 0 b = noexcept(throw 0); b = f1(); b = f2(); diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp index e4d1537cdc..5182709c89 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -19,12 +19,14 @@ void nospec(); void allspec() throw(...); void intspec() throw(int); void emptyspec() throw(); +void nothrowattr() __attribute__((nothrow)); void call() { N(nospec()); N(allspec()); N(intspec()); P(emptyspec()); + P(nothrowattr()); } void (*pnospec)(); |