[clang] Add sycl_external attribute (PR #140282)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 20:45:28 PDT 2025


================
@@ -408,10 +408,14 @@ class SubjectList<list<AttrSubject> subjects, SubjectDiag diag = WarnDiag,
   string CustomDiag = customDiag;
 }
 
-class LangOpt<string name, code customCode = [{}]> {
+class LangOpt<string name, code customCode = [{}], bit silentlyIgnore = 0> {
   // The language option to test; ignored when custom code is supplied.
   string Name = name;
 
+  // If set to 1, the attribute is accepted but is silently ignored. This is
+  // useful in multi-compilation situations like SYCL.
+  bit SilentlyIgnore = silentlyIgnore;
+
----------------
tahonermann wrote:

None of the proposed changes query this bit (downstream Intel repos have additional code in `GenerateTestExpression()` in `clang/utils/TableGen/ClangAttrEmitter.cpp` that checks it).

I think we should hold off on adding this for now. Or, we should add it via a separate PR that justifies its use based on similar existing utility for CUDA, HIP, HLSL, etc...

https://github.com/llvm/llvm-project/pull/140282


More information about the cfe-commits mailing list