[clang] [Clang][OpenMP] Emit unsupported directive error (PR #70233)
Raymond Chang via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 24 13:23:15 PST 2023
https://github.com/rkchang updated https://github.com/llvm/llvm-project/pull/70233
>From 72c056b825963d0de1dcf3fe3a6de922098d0ad9 Mon Sep 17 00:00:00 2001
From: Raymond Chang <raymondkenchang at gmail.com>
Date: Thu, 12 Oct 2023 01:51:03 -0400
Subject: [PATCH 1/3] Emit unsupported directive error
---
clang/lib/CodeGen/CGStmt.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index c719df1bfa05036..4eeaf9645a3eab8 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -407,7 +407,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs) {
EmitOMPInteropDirective(cast<OMPInteropDirective>(*S));
break;
case Stmt::OMPDispatchDirectiveClass:
- llvm_unreachable("Dispatch directive not supported yet.");
+ CGM.ErrorUnsupported(S, "OpenMP dispatch directive");
break;
case Stmt::OMPScopeDirectiveClass:
llvm_unreachable("scope not supported with FE outlining");
>From 65d61090cf6f66a8b6a236e24a775806b5339df9 Mon Sep 17 00:00:00 2001
From: Raymond Chang <raymondkenchang at gmail.com>
Date: Wed, 22 Nov 2023 01:03:31 -0500
Subject: [PATCH 2/3] Add test case
---
clang/test/OpenMP/dispatch_unsupported.c | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 clang/test/OpenMP/dispatch_unsupported.c
diff --git a/clang/test/OpenMP/dispatch_unsupported.c b/clang/test/OpenMP/dispatch_unsupported.c
new file mode 100644
index 000000000000000..ff0815dda6a3fd9
--- /dev/null
+++ b/clang/test/OpenMP/dispatch_unsupported.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm -fopenmp -disable-llvm-passes %s -verify=expected
+
+// expected-error at +2 {{cannot compile this OpenMP dispatch directive yet}}
+void a(){
+ #pragma omp dispatch
+ a();
+}
\ No newline at end of file
>From 3601f5a5ba41efdb0904a6b790aaa641321110fe Mon Sep 17 00:00:00 2001
From: Raymond Chang <raymondkenchang at gmail.com>
Date: Fri, 24 Nov 2023 16:23:01 -0500
Subject: [PATCH 3/3] Add empty line
---
clang/test/OpenMP/dispatch_unsupported.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/OpenMP/dispatch_unsupported.c b/clang/test/OpenMP/dispatch_unsupported.c
index ff0815dda6a3fd9..92f555e4b414f4e 100644
--- a/clang/test/OpenMP/dispatch_unsupported.c
+++ b/clang/test/OpenMP/dispatch_unsupported.c
@@ -4,4 +4,4 @@
void a(){
#pragma omp dispatch
a();
-}
\ No newline at end of file
+}
More information about the cfe-commits
mailing list