summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-05-02 16:52:07 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-05-02 16:52:07 +0000
commit1ab34573197db6efd1eb07b95b836e46f1f88478 (patch)
treeb6d6e21b55f9a2ce3ef17ca0cd09bbd9677bf9b5 /clang/lib/Sema/SemaStmt.cpp
parent150cb6d91af313b84f1876e8a1f016cfe1e1e6d5 (diff)
downloadbcm5719-llvm-1ab34573197db6efd1eb07b95b836e46f1f88478.tar.gz
bcm5719-llvm-1ab34573197db6efd1eb07b95b836e46f1f88478.zip
[OPENMP] Enable c++ exceptions outside of the target constructs iff they are
enabled for the host. If the compilation for the host enables C++ exceptions, but they are not supported by the device, we still need to allow the code with the exception handling constructs outside of the target regions. llvm-svn: 331372
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index c3a627f1d36..d3224b75f45 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -3942,7 +3942,11 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
ArrayRef<Stmt *> Handlers) {
// Don't report an error if 'try' is used in system headers.
if (!getLangOpts().CXXExceptions &&
- !getSourceManager().isInSystemHeader(TryLoc))
+ !getSourceManager().isInSystemHeader(TryLoc) &&
+ (!getLangOpts().OpenMPIsDevice ||
+ !getLangOpts().OpenMPHostCXXExceptions ||
+ isInOpenMPTargetExecutionDirective() ||
+ isInOpenMPDeclareTargetContext()))
Diag(TryLoc, diag::err_exceptions_disabled) << "try";
// Exceptions aren't allowed in CUDA device code.
OpenPOWER on IntegriCloud