[cfe-commits] r113650 - in /cfe/trunk: include/clang/AST/ExprCXX.h lib/AST/Expr.cpp lib/Serialization/ASTReaderStmt.cpp test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Fri Sep 10 15:34:40 PDT 2010
Author: cornedbee
Date: Fri Sep 10 17:34:40 2010
New Revision: 113650
URL: http://llvm.org/viewvc/llvm-project?rev=113650&view=rev
Log:
Address Doug's comments.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=113650&r1=113649&r2=113650&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Fri Sep 10 17:34:40 2010
@@ -2441,9 +2441,6 @@
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,
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=113650&r1=113649&r2=113650&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri Sep 10 17:34:40 2010
@@ -1347,6 +1347,11 @@
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 @@
case VAArgExprClass:
case CXXDefaultArgExprClass:
case CXXBindTemporaryExprClass:
- case CXXExprWithTemporariesClass:
+ case CXXExprWithTemporariesClass: // FIXME: this thing calls destructors
case ObjCIvarRefExprClass:
case ObjCIsaExprClass:
case ShuffleVectorExprClass:
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=113650&r1=113649&r2=113650&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Fri Sep 10 17:34:40 2010
@@ -1255,9 +1255,9 @@
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) {
Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp?rev=113650&r1=113649&r2=113650&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp Fri Sep 10 17:34:40 2010
@@ -11,9 +11,9 @@
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();
Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp?rev=113650&r1=113649&r2=113650&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp Fri Sep 10 17:34:40 2010
@@ -19,12 +19,14 @@
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)();
More information about the cfe-commits
mailing list