diff options
author | Anders Carlsson <andersca@mac.com> | 2011-02-19 23:53:54 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-02-19 23:53:54 +0000 |
commit | da4b7cf09ebfd4e4098b516081fa9dae2f5c99e0 (patch) | |
tree | b0fe5871f0554281f460a114de248e62a38875a2 /lib/Sema/SemaStmt.cpp | |
parent | 4b93d660c6326ec79b5e369317d1051cf826c2f3 (diff) |
Add a new ObjCExceptions member variable to LangOptions. This controls whether Objective-C exceptions are enabled or not (they are by default).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 61ab3d3a5b..e995e8f207 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1631,6 +1631,9 @@ Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) { StmtResult Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg CatchStmts, Stmt *Finally) { + if (!getLangOptions().ObjCExceptions) + Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@try"; + getCurFunction()->setHasBranchProtectedScope(); unsigned NumCatchStmts = CatchStmts.size(); return Owned(ObjCAtTryStmt::Create(Context, AtLoc, Try, @@ -1661,6 +1664,9 @@ StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, StmtResult Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope) { + if (!getLangOptions().ObjCExceptions) + Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@throw"; + if (!Throw) { // @throw without an expression designates a rethrow (which much occur // in the context of an @catch clause). |