Don't give an error for 'try' and 'throw' if they occur in system headers.

llvm-svn: 126303
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 0abd79a..64827ff 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1766,8 +1766,10 @@
 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 &&