[C2x] Implement support for nullptr and nullptr_t
authorAaron Ballman <aaron@aaronballman.com>
Fri, 14 Oct 2022 14:04:34 +0000 (10:04 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 14 Oct 2022 14:06:02 +0000 (10:06 -0400)
commit3a31970ee2af24ffcfd4b6fc11ac9bdf4d4ef2e8
treeaf1dbf0e43d7cb2d0c7fa02b0dcce8c98af55ce9
parent1af75417414236bd163e62c383c8607bb44cb834
[C2x] Implement support for nullptr and nullptr_t

This introduces support for nullptr and nullptr_t in C2x mode. The
proposal accepted by WG14 is:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm

Note, there are quite a few incompatibilities with the C++ feature in
some of the edge cases of this feature. Therefore, there are some FIXME
comments in tests for testing behavior that might change after WG14 has
resolved national body comments (a process we've not yet started). So
this implementation might change slightly depending on the resolution
of comments. This is called out explicitly in the release notes as
well.

Differential Revision: https://reviews.llvm.org/D135099
21 files changed:
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/ExprCXX.h
clang/include/clang/AST/PrettyPrinter.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/TokenKinds.def
clang/lib/AST/Expr.cpp
clang/lib/AST/Type.cpp
clang/lib/Headers/stddef.h
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaCast.cpp
clang/lib/Sema/SemaCodeComplete.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/C/C11/n1330.c
clang/test/C/C2x/n3042.c [new file with mode: 0644]
clang/test/Sema/nullptr-prec2x.c [new file with mode: 0644]
clang/test/Sema/nullptr.c [new file with mode: 0644]
clang/test/Sema/static-assert.c
clang/www/c_status.html