[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 07:07:27 PDT 2020


riccibruno created this revision.
riccibruno added reviewers: rsmith, aaron.ballman, erichkeane.
riccibruno added a project: clang.
Herald added subscribers: cfe-commits, arphaman, dexonsmith.

See D84656 <https://reviews.llvm.org/D84656> for the background on `NamedDecl::printName`.

This patch overloads `NamedDecl::printName` for `VarDecl`, `FieldDecl` ,`RecordDecl` and `EnumDecl` to provide a more user-friendly name in diagnostics. We try to only use the term "anonymous" when we have an anonymous struct or union; otherwise we use the term "unnamed".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84658

Files:
  clang/include/clang/AST/Decl.h
  clang/lib/AST/Decl.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/AST/ast-dump-APValue-anon-union.cpp
  clang/test/AST/ast-dump-record-definition-data-json.cpp
  clang/test/Analysis/explain-svals.cpp
  clang/test/CXX/special/class.dtor/p5-0x.cpp
  clang/test/Index/annotate-comments-typedef.m
  clang/test/Index/annotate-tokens.cpp
  clang/test/Index/c-index-api-loadTU-test.m
  clang/test/Index/c-index-getCursor-test.m
  clang/test/Index/linkage.c
  clang/test/Index/load-decls.c
  clang/test/Index/load-namespaces.cpp
  clang/test/Index/preamble.c
  clang/test/Index/print-bitwidth.c
  clang/test/Index/print-type.c
  clang/test/Index/print-type.cpp
  clang/test/Index/recursive-cxx-member-calls.cpp
  clang/test/Index/targeted-annotation.c
  clang/test/Index/targeted-cursor.c
  clang/test/Index/usrs.m
  clang/test/Modules/module-private.cpp
  clang/test/Sema/address-packed.c
  clang/test/Sema/attr-flag-enum.c
  clang/test/Sema/transparent-union.c
  clang/test/SemaCXX/attr-unused.cpp
  clang/test/SemaCXX/cxx0x-nontrivial-union.cpp
  clang/test/SemaCXX/lambda-expressions.cpp
  clang/test/SemaCXX/ms-interface.cpp
  clang/test/SemaCXX/warn-large-by-value-copy.cpp
  clang/test/SemaObjCXX/arc-0x.mm
  clang/test/Tooling/clang-diff-ast.cpp
  clang/unittests/AST/ASTTraverserTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84658.280900.patch
Type: text/x-patch
Size: 54496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200727/77b8e3e9/attachment-0001.bin>


More information about the cfe-commits mailing list