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 <raymondkench...@gmail.com> 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<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"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits