https://github.com/xlauko created https://github.com/llvm/llvm-project/pull/220893
hasCustomAssemblyFormat with no explanation invites the question of whether a declarative assemblyFormat would do, and the answer is not obvious from the parameter list. It would not. The three flags print as presence-only keywords and parse in any order, while an optional group anchored on a `bool` parameter parses and prints a value, so the group would spell `extern true`. MLIR has no presence-only flag for `bool` in an attribute format, unlike UnitAttr in an operation format. struct(params) does round-trip, but spells the attribute `<device_side_name = "i", kind = Variable, isExtern = true>` instead of `<i, Variable, extern>`. NFC. --- Stacked on #220892. Based on `users/xlauko/cir-enum-13-inline-mnemonic`, so the diff shown is this commit alone. >From 7234761bf1869f98d9e66c70b95407795ebf482b Mon Sep 17 00:00:00 2001 From: Henrich Lauko <[email protected]> Date: Thu, 3 Sep 2026 11:29:23 +0000 Subject: [PATCH] [CIR] Record why the CUDA registration attribute parses itself hasCustomAssemblyFormat with no explanation invites the question of whether a declarative assemblyFormat would do, and the answer is not obvious from the parameter list. It would not. The three flags print as presence-only keywords and parse in any order, while an optional group anchored on a `bool` parameter parses and prints a value, so the group would spell `extern true`. MLIR has no presence-only flag for `bool` in an attribute format, unlike UnitAttr in an operation format. struct(params) does round-trip, but spells the attribute `<device_side_name = "i", kind = Variable, isExtern = true>` instead of `<i, Variable, extern>`. NFC. --- clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td index 3362ff1812e34..c3662a92a43b8 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td @@ -92,6 +92,11 @@ def CIR_CUDAVarRegistrationInfoAttr : CIR_Attr<"CUDAVarRegistrationInfo", "cu.va "bool":$isManaged ); + // Not expressible as a declarative assemblyFormat. The three flags print as + // presence-only keywords and parse in any order, whereas an optional group + // anchored on a `bool` parameter parses and prints a value, so `extern` + // would have to spell `extern true`. struct(params) round-trips but costs + // the compact syntax. let hasCustomAssemblyFormat = 1; } _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
