[clang] [Clang][OpenMP] Emit unsupported directive error (PR #70233)
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 Date: Thu, 12 Oct 2023 01:51:03 -0400 Subject: [PATCH 1/2] 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 Attrs) { EmitOMPInteropDirective(cast(*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 Date: Wed, 22 Nov 2023 01:03:31 -0500 Subject: [PATCH 2/2] 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 000..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@+2 {{cannot compile this OpenMP dispatch directive yet}} +void a(){ +#pragma omp dispatch +a(); +} \ No newline at end of file ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][OpenMP] Emit unsupported directive error (PR #70233)
rkchang wrote: Added a test case. Thanks for the pointer! Here's the result: ``` ~/dev/fork-llvm-project omp_dispatch_unimpl ❯ llvm-lit -vv clang/test/OpenMP/dispatch_unsupported.c llvm-lit: /home/rkchang/dev/fork-llvm-project/llvm/utils/lit/lit/llvm/config.py:488: note: using clang: /home/rkchang/dev/fork-llvm-project/build/bin/clang -- Testing: 1 tests, 1 workers -- PASS: Clang :: OpenMP/dispatch_unsupported.c (1 of 1) Testing Time: 0.07s Total Discovered Tests: 1 Passed: 1 (100.00%) ``` https://github.com/llvm/llvm-project/pull/70233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][OpenMP] Emit unsupported directive error (PR #70233)
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 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 Attrs) { EmitOMPInteropDirective(cast(*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 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 000..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@+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 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 +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][OpenMP] Emit unsupported directive error (PR #70233)
@@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm -fopenmp -disable-llvm-passes %s -verify=expected + +// expected-error@+2 {{cannot compile this OpenMP dispatch directive yet}} +void a(){ +#pragma omp dispatch +a(); +} rkchang wrote: Added, thanks https://github.com/llvm/llvm-project/pull/70233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Emit unsupported directive error (PR #70233)
https://github.com/rkchang created https://github.com/llvm/llvm-project/pull/70233 Hello! This PR addresses #63871. Clang should no longer crash and instead emits an error message. @shiltian is this what you had in mind for an error message? I think I followed everything in [1] but I did not add a unit test as this behavior should change in the future when dispatch is implemented. Also I did not find any existing unit tests that test for behavior like this. Below is an example of the new error message: ``` test.c:6:5: error: cannot compile this OpenMP dispatch directive yet 6 | #pragma omp dispatch | ^~~~ 1 error generated. ``` Please let me know if there's anything you'd like me to change. PS. This is my first open source contribution so if there's any etiquette or instructions I missed please let me know. [1] https://llvm.org/docs/Contributing.html >From 837e2882d23f998e166b7a85bf5339bab4884617 Mon Sep 17 00:00:00 2001 From: Raymond Chang Date: Thu, 12 Oct 2023 01:51:03 -0400 Subject: [PATCH] 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 Attrs) { EmitOMPInteropDirective(cast(*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"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Emit unsupported directive error (PR #70233)
https://github.com/rkchang edited https://github.com/llvm/llvm-project/pull/70233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Emit unsupported directive error (PR #70233)
https://github.com/rkchang edited https://github.com/llvm/llvm-project/pull/70233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Emit unsupported directive error (PR #70233)
https://github.com/rkchang edited https://github.com/llvm/llvm-project/pull/70233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits