[clang] [Clang] Add C++11/C23-style spellings for Swift import attributes (PR #183484)
Tshaka Lekholoane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 20 03:51:00 PDT 2026
https://github.com/tshakalekholoane updated https://github.com/llvm/llvm-project/pull/183484
>From a384fe750ad1c760ed2c1a881fee608ea9666769 Mon Sep 17 00:00:00 2001
From: Tshaka Lekholoane <mail+git at tshaka.dev>
Date: Mon, 20 Jul 2026 12:40:43 +0200
Subject: [PATCH] [Clang] Add FIXME for missing [[]] spelling on Swift interop
attributes
Several Swift interop attributes (swift_name, swift_attr, swift_private,
and so on) currently only support the GNU __attribute__ syntax. Adding a
C++11/C23 [[]] spelling was considered, but choosing between a clang or
swift namespace deserves more attention than this change intended to
give it, so it is left as a FIXME for now.
See discussion in #183484.
---
clang/include/clang/Basic/Attr.td | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 328e70b3ed900..c0683f978bf3f 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3147,6 +3147,17 @@ def Regparm : TypeAttr {
let ASTNode = 0;
}
+// FIXME: The following Swift interop attributes currently only support
+// the GNU __attribute__ syntax and lack a CXX11/C23 [[]] spelling.
+//
+// A Clang vendor namespace spelling (e.g., [[clang::swift_name]]) or a
+// Swift vendor namespace spelling (e.g., [[swift::name]]) were both
+// considered, but it was decided not to commit to either prematurely.
+// Doing so deserves more attention -- among other things, one would
+// want to avoid name stuttering (e.g., [[swift::swift_name]]).
+//
+// See https://github.com/llvm/llvm-project/pull/183484
+
def SwiftType : Attr {
// This attribute has no spellings as it is only ever created implicitly
// from API notes.
More information about the cfe-commits
mailing list