[clang] [Clang] Add __builtin_bswapg (PR #162433)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 10 00:57:27 PDT 2025


================
@@ -755,6 +755,12 @@ def BSwap : Builtin, Template<["unsigned short", "uint32_t", "uint64_t"],
   let Prototype = "T(T)";
 }
 
+def BSwapg : Builtin {
+  let Spellings = ["__builtin_bswapg"];
+  let Attributes = [NoThrow, Const, Constexpr, CustomTypeChecking];
+  let Prototype = "int(...)";
----------------
ojhunt wrote:

IIRC `T(T)` assumes an explicit set of type mappings. In _principle_ I think this could be labeled as `T(T)` with the customtypechecking flag. That would be more correct than `int(..)`, and the Sema work is already doing the custom checking.

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


More information about the cfe-commits mailing list