OSDN Git Service

Add new 'preferred_name' attribute.
authorRichard Smith <richard@metafoo.co.uk>
Thu, 12 Nov 2020 01:12:18 +0000 (17:12 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Wed, 9 Dec 2020 20:22:35 +0000 (12:22 -0800)
commit2a2c228c7ada0a5d77c48b4d445ab0013ca0ae19
treebb822e9b6f9bcabf708116dbcf0c6bafc40f6674
parent997a719d5a70100fcbbec1e51ce44cd66041bddc
Add new 'preferred_name' attribute.

This attribute permits a typedef to be associated with a class template
specialization as a preferred way of naming that class template
specialization. This permits us to specify that (for example) the
preferred way to express 'std::basic_string<char>' is as 'std::string'.

The attribute is applied to the various class templates in libc++ that have
corresponding well-known typedef names.

This is a re-commit. The previous commit was reverted because it exposed
a pre-existing bug that has since been fixed / worked around; see
PR48434.

Differential Revision: https://reviews.llvm.org/D91311
15 files changed:
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/AST/TypePrinter.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/PCH/decl-attrs.cpp [new file with mode: 0644]
clang/test/SemaTemplate/attributes.cpp
clang/utils/TableGen/ClangAttrEmitter.cpp
libcxx/include/__config
libcxx/include/iosfwd
libcxx/include/regex
libcxx/include/string
libcxx/include/string_view