[libcxx-commits] [PATCH] D91311: Add new 'preferred_name' attribute.

Richard Smith - zygoloid via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 10 18:11:57 PST 2020


rsmith added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2384
+  let Spellings = [Clang<"preferred_name", /*AllowInC*/0>];
+  let Subjects = SubjectList<[ClassTmpl]>;
+  let Args = [TypeArgument<"TypedefType">];
----------------
jyknight wrote:
> I wonder if this attribute ought to be allowed to be used on any Record (which would make it potentially also valid for C). In case you also wanted to do something like this in the future:
> 
> ```
> class any;
> using any_copyable = any;
> 
> class [[clang::preferred_name(any_copyable)]] any { ... };
> ```
> 
I think that would be reasonable, if the generalized attribute would see usage. If we're going to generalize it that way, I think it'd make sense to allow it on enums too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91311



More information about the libcxx-commits mailing list