[llvm-branch-commits] [clang] [CIR] Drop dead ceremony around the CIR enum attributes (PR #220890)

Henrich Lauko via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 3 04:31:32 PDT 2026


https://github.com/xlauko created https://github.com/llvm/llvm-project/pull/220890

Five things that no longer earn their place, all in the enum attribute
machinery this stack has been reworking.

CIR_CleanupKindAttr carried three of them. Its cppClassName was a no-op.
CIR_EnumAttr derives from AttrDef<dialect, enumInfo.className>, and AttrDef
already defaults cppClassName to name # "Attr", which is exactly
CleanupKindAttr. Its skipDefaultBuilders plus hand-written AttrBuilder
existed only to default $value to CleanupKind::All. All three callers
(cir.while, cir.for and parseCleanupKind) pass an explicit kind, so the
default was unreachable while the generated builders stayed suppressed for
nothing. And its summary and description restated the name, overriding the
enum's own "cleanup kind" with a longer synonym. EnumAttr inherits both, so
deleting the overrides improves the generated dialect docs. Only the
isNormal / isEH / isNormalAndEH helpers were doing any work, and they stay.

CIR_TLSModelAttr's summary restated the name the same way. Its description
is informative, so only the summary goes.

CIR_DefaultValuedEnumParameter has never had a user anywhere in the tree.

NFC.

---

Stacked on #220889. Based on `users/xlauko/cir-enum-10-hoist-genspecialized`, so the diff shown is this commit alone.


>From a92881c9b6aed604875157ef3a78beeb94eacbe5 Mon Sep 17 00:00:00 2001
From: Henrich Lauko <hlauko at nvidia.com>
Date: Thu, 3 Sep 2026 11:29:23 +0000
Subject: [PATCH] [CIR] Drop dead ceremony around the CIR enum attributes

Five things that no longer earn their place, all in the enum attribute
machinery this stack has been reworking.

CIR_CleanupKindAttr carried three of them. Its cppClassName was a no-op.
CIR_EnumAttr derives from AttrDef<dialect, enumInfo.className>, and AttrDef
already defaults cppClassName to name # "Attr", which is exactly
CleanupKindAttr. Its skipDefaultBuilders plus hand-written AttrBuilder
existed only to default $value to CleanupKind::All. All three callers
(cir.while, cir.for and parseCleanupKind) pass an explicit kind, so the
default was unreachable while the generated builders stayed suppressed for
nothing. And its summary and description restated the name, overriding the
enum's own "cleanup kind" with a longer synonym. EnumAttr inherits both, so
deleting the overrides improves the generated dialect docs. Only the
isNormal / isEH / isNormalAndEH helpers were doing any work, and they stay.

CIR_TLSModelAttr's summary restated the name the same way. Its description
is informative, so only the summary goes.

CIR_DefaultValuedEnumParameter has never had a user anywhere in the tree.

NFC.
---
 .../include/clang/CIR/Dialect/IR/CIREnumAttr.td  |  5 -----
 clang/include/clang/CIR/Dialect/IR/CIROps.td     | 16 ----------------
 2 files changed, 21 deletions(-)

diff --git a/clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td b/clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td
index 22cc0e6e4b7a6..3659eb71257f8 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td
@@ -55,11 +55,6 @@ class CIR_EnumAttr<EnumAttrInfo info, string name = "", list<Trait> traits = []>
   let assemblyFormat = "`<` $value `>`";
 }
 
-class CIR_DefaultValuedEnumParameter<EnumAttrInfo info, string value = "">
-    : EnumParameter<info> {
-  let defaultValue = value;
-}
-
 def CIR_LangAddressSpace : CIR_I32EnumAttr<
   "LangAddressSpace", "language address space kind", [
   I32EnumAttrCase<"Default", 0, "default">,
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 5d2b2da4a404d..7eefd035eedb8 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -1353,21 +1353,6 @@ def CIR_CleanupKind : CIR_I32EnumAttr<"CleanupKind", "cleanup kind", [
 ]>;
 
 def CIR_CleanupKindAttr : CIR_EnumAttr<CIR_CleanupKind, "cleanup"> {
-  let summary = "Cleanup kind attribute";
-  let description = [{
-    Cleanup kind attributes.
-  }];
-
-  let cppClassName = "CleanupKindAttr";
-
-  let skipDefaultBuilders = 1;
-  let builders = [
-    AttrBuilder<(ins CArg<"CleanupKind",
-                          "cir::CleanupKind::All">:$value), [{
-      return $_get($_ctxt, value);
-    }]>
-  ];
-
   let extraClassDeclaration = [{
     bool isNormal() const {
       return getValue() == CleanupKind::Normal ||
@@ -3336,7 +3321,6 @@ def CIR_TLSModel : CIR_I32EnumAttr<"TLSModel", "TLS model", [
 ]>;
 
 def CIR_TLSModelAttr: CIR_EnumAttr<CIR_TLSModel, "tls_model"> {
-  let summary = "TLS Model attribute";
   let description = [{
      The TLS mode for the global, which comes from either the
     `tls_model` attribute, or `-ftls-model` flag.



More information about the llvm-branch-commits mailing list