[PATCH] D84658: [clang] Overload NamedDecl::printName to provide a user-friendly name for unnamed entities

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 13:36:19 PDT 2020


riccibruno marked an inline comment as done.
riccibruno added inline comments.


================
Comment at: clang/lib/AST/Decl.cpp:2032
+  // additional complexity needed to prevent this is not worthwhile.
+  OS << (Policy.MSVCFormatting ? '`' : '(')
+     << (IsAnonymousStructOrUnion ? "anonymous" : "unnamed") << ' '
----------------
riccibruno wrote:
> erichkeane wrote:
> > riccibruno wrote:
> > > erichkeane wrote:
> > > > This pattern is happening a bunch too....  Does it deserve some function?  Perhaps a function that either takes Policy, or a member of Policy to get the formatting open-tick or close-tick?
> > > Do you mean a member function of `PrintingPolicy`, something like `getOpenTick` and `getCloseTick`?
> > Yeah, exactly, something like that. "Delimiter" is perhaps better than 'tick', but I'm not attached to either.
> "Delimiter" sounds good to me. Thanks for the suggestion!
I will fix the other instances of this pattern elsewhere as a follow-up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84658





More information about the cfe-commits mailing list