[PATCH] D50390: [SEMA]Uniform printing of Attributes

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 08:47:54 PDT 2018


erichkeane created this revision.
erichkeane added reviewers: aaron.ballman, rjmccall.

The recent patch that reordered parsed attributes made it clear
that the diagnostics when printing attributes were incredibly 
inconsistent.  in the mutual-exclusion case, the order of the
attributes would change which was printed with leading/trailing
underscores.

This is because GNU attributes are permitted to be spelled with
leading/trailing underscores, but are quickly normalized after
parsing.  Therefore, any attribute that had been converted to a 
Attr type would only have the non-underscored type.

This patch adds a diagnostic category for a quoted-std-string,
as well as overloads for operator<< to permit ParsedAttr to be
sent to be emitted directly.

THEN, this patch changes everywhere that we were doing PA.getName()
in a diagnostic (which got the IdentifierInfo, which hadn't been
normalized) and replaces it with a call to the new operator<<.

The result is that ALL attributes are now uniformly printed with
the normalized name, rather than a mix of names.


https://reviews.llvm.org/D50390

Files:
  include/clang/Basic/Diagnostic.h
  include/clang/Basic/PartialDiagnostic.h
  include/clang/Sema/ParsedAttr.h
  include/clang/Sema/Sema.h
  lib/Basic/Diagnostic.cpp
  lib/Sema/ParsedAttr.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaStmtAttr.cpp
  lib/Sema/SemaType.cpp
  test/Sema/attr-coldhot.c
  test/Sema/attr-min-vector-width.c
  test/Sema/attr-minsize.c
  test/Sema/attr-unavailable-message.c
  test/SemaObjC/attr-objc-exception.m
  test/SemaObjC/method-sentinel-attr.m
  utils/TableGen/ClangAttrEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50390.159518.patch
Type: text/x-patch
Size: 76649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180807/8f18c4a3/attachment-0001.bin>


More information about the cfe-commits mailing list