[clang] [clang][SYCL] Diagnose variadic sycl_external function (PR #216393)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 20:49:38 PDT 2026
================
@@ -5,7 +5,9 @@
// RUN: %clang_cc1 -triple spirv64-unknown-unknown -aux-triple x86_64-pc-windows-msvc \
// RUN: -fsycl-is-device -emit-llvm -o - %s | FileCheck --check-prefix=WINDOWS %s
-[[clang::sycl_external]] int f(int n, ...) {
+/// The sycl_external attribute is ignored for a variadic function, so 'f' is
+/// emitted because 'g' references it.
----------------
tahonermann wrote:
I don't understand this comment. There doesn't appear to be a `sycl_external` attribute present to be ignored (not any more anyway). I think the goal of this test is to exercise ODR-use of a variadic function by a device function, but in a way that doesn't involve calling it (which would require a diagnostic per [SYCL 2020 section 5.4, "Language restrictions for device functions"](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:language.restrictions.kernels)). How about this?
```suggestion
// SYCL 2020 section 5.4, "Language restrictions for device functions", prohibits
// calls to variadic functions in device code, but doesn't prohibit other ODR-uses.
// Function f() is emitted during device compilation due to the ODR-use in g().
```
https://github.com/llvm/llvm-project/pull/216393
More information about the cfe-commits
mailing list