[PATCH] D87652: Sema: add support for `__attribute__((__swift_newtype__))`

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 05:55:59 PDT 2020


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2172
+def SwiftNewType : InheritableAttr {
+  // `swift_wrapper` is a "deprecated" alias and kept for compatibility with
+  // shipped toolchains.  New users should prefer the `swift_newtype` spelling.
----------------
Should we make these docs part of the public docs in AttrDocs.td? That's sort of what I had in mind with my comment (so that if someone runs into the attribute in the wild and wonders what it is, they have a hint).


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:5964
+  if (!isa<TypedefNameDecl>(D)) {
+    S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type)
+        << AL << /* typedefs */13;
----------------
Rather than adding a new enumeration to `warn_attribute_wrong_decl_type`, I would use `warn_attribute_wrong_decl_type_str` and pass in the string as part of the diagnostic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87652



More information about the cfe-commits mailing list