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,
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>())) {
case VAArgExprClass:
case CXXDefaultArgExprClass:
case CXXBindTemporaryExprClass:
- case CXXExprWithTemporariesClass:
+ case CXXExprWithTemporariesClass: // FIXME: this thing calls destructors
case ObjCIvarRefExprClass:
case ObjCIsaExprClass:
case ShuffleVectorExprClass:
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) {
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();
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)();