diff options
| author | Anders Carlsson <andersca@mac.com> | 2011-02-23 03:46:46 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2011-02-23 03:46:46 +0000 |
| commit | d99dbcc2a9d257c3572030d27cb5fc32d5dbd093 (patch) | |
| tree | 610228a0b3602e35cc566b16932f8d5410253996 /clang/lib/Sema | |
| parent | 34770edf4396c4106f396a98a1d0a1a93afe3797 (diff) | |
| download | bcm5719-llvm-d99dbcc2a9d257c3572030d27cb5fc32d5dbd093.tar.gz bcm5719-llvm-d99dbcc2a9d257c3572030d27cb5fc32d5dbd093.zip | |
Don't give an error for 'try' and 'throw' if they occur in system headers.
llvm-svn: 126303
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index f9c2c9a62ea..a051661285d 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -476,7 +476,9 @@ Sema::ActOnCXXNullPtrLiteral(SourceLocation Loc) { /// ActOnCXXThrow - Parse throw expressions. ExprResult Sema::ActOnCXXThrow(SourceLocation OpLoc, Expr *Ex) { - if (!getLangOptions().Exceptions) + // Don't report an error if 'throw' is used in system headers. + if (!getLangOptions().Exceptions && + !getSourceManager().isInSystemHeader(OpLoc)) Diag(OpLoc, diag::err_exceptions_disabled) << "throw"; if (Ex && !Ex->isTypeDependent() && CheckCXXThrowOperand(OpLoc, Ex)) diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 0abd79a696f..64827ff1779 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -1766,8 +1766,10 @@ public: StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, MultiStmtArg RawHandlers) { - if (!getLangOptions().Exceptions) - Diag(TryLoc, diag::err_exceptions_disabled) << "try"; + // Don't report an error if 'try' is used in system headers. + if (!getLangOptions().Exceptions && + !getSourceManager().isInSystemHeader(TryLoc)) + Diag(TryLoc, diag::err_exceptions_disabled) << "try"; unsigned NumHandlers = RawHandlers.size(); assert(NumHandlers > 0 && |

