[PATCH] D148700: [clang] Add support for “regular” keyword attributes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 06:09:51 PDT 2023


aaron.ballman added a comment.

This basically LGTM, but we should add documentation to the internals manual too: https://clang.llvm.org/docs/InternalsManual.html#spellings



================
Comment at: clang/lib/AST/TypePrinter.cpp:1724-1727
+  if (T->getAttrKind() == attr::ArmStreaming) {
+    OS << "__arm_streaming";
+    return;
+  }
----------------
rsandifo-arm wrote:
> aaron.ballman wrote:
> > This seems like something that tablegen should automatically handle more generally for these attributes.
> I wondered about trying to use tablegen for TypePrinter::printAttributedAfter, but decided against it. 
>  RegularKeyword is really a spelling-level classification rather than an attribute-level classification, and in general, an attribute could have both GNU and RegularKeyword spellings. In contrast, printAttributedAfter is only given the attribute kind and the type that results from applying the attribute. AFAIK, it doesn't have access to the original attribute spelling. This means that some attribute-specific or type-specific knowledge might be needed to print the attribute in the best way.
Yeah, we've run into this problem a number of times. Ultimately, we should retain what spelling the user used because that's salient information for the AST (for example, doing AST matching looking for an `AlignedAttr` attribute where the spelling used matters for the intended semantics. But that's not something you need to address.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:5262
+  case ParsedAttr::AT_ArmStreaming:
+    CC = CC_C; // Placeholder until real SME support is added.
+    break;
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148700/new/

https://reviews.llvm.org/D148700



More information about the cfe-commits mailing list