[clang] [Driver][SYCL] Error on C inputs when compiling with -fsycl (PR #200318)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 4 13:46:35 PDT 2026
================
@@ -0,0 +1,7 @@
+// Verify that a .c file compiled with -fsycl is an error.
+// RUN: not %clang -### -fsycl %s 2>&1 | FileCheck -check-prefix ERR %s
+// ERR: error: invalid argument '{{.*}}sycl-c-warn.c' not allowed with '-fsycl'
+
+// Verify that explicitly forcing -x c with -fsycl is also an error.
----------------
AaronBallman wrote:
I guess I'm not seeing why the driver would provide a more user-friendly error message; I think the messages would be the same either way? But if it turns out that my suggestion has a poor user experience, I don't insist it only be done from the frontend -- I am mostly trying to avoid duplicating the logic for checking for a C compilation unit. Everything eventually funnels through the frontend, so it seems most reasonable to catch it there instead of from the driver.
https://github.com/llvm/llvm-project/pull/200318
More information about the cfe-commits
mailing list