[PATCH] D154334: [clang] Add `__has_extension ()` for C++11 features
Mariya Podchishchaeva via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 3 04:00:52 PDT 2023
Fznamznon created this revision.
Herald added a project: All.
Fznamznon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Add `__has_extension (cxx_defaulted_functions)` and
`__has_extension (cxx_defaulted_functions)` since they are accepted in
C++98 mode as extensions.
Fixes https://github.com/llvm/llvm-project/issues/61758
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154334
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/Features.def
clang/test/Lexer/has_extension_cxx.cpp
Index: clang/test/Lexer/has_extension_cxx.cpp
===================================================================
--- clang/test/Lexer/has_extension_cxx.cpp
+++ clang/test/Lexer/has_extension_cxx.cpp
@@ -11,6 +11,16 @@
int c_generic_selections();
#endif
+// CHECK: has_deleted_functions
+#if __has_extension(cxx_default_function_template_args)
+int has_deleted_functions();
+#endif
+
+// CHECK: has_deleted_functions
+#if __has_extension(cxx_defaulted_functions)
+int has_deleted_functions();
+#endif
+
// CHECK: has_deleted_functions
#if __has_extension(cxx_deleted_functions)
int has_deleted_functions();
Index: clang/include/clang/Basic/Features.def
===================================================================
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -247,6 +247,8 @@
EXTENSION(c_thread_local, PP.getTargetInfo().isTLSSupported())
// C++11 features supported by other languages as extensions.
EXTENSION(cxx_atomic, LangOpts.CPlusPlus)
+EXTENSION(cxx_default_function_template_args, LangOpts.CPlusPlus)
+EXTENSION(cxx_defaulted_functions, LangOpts.CPlusPlus)
EXTENSION(cxx_deleted_functions, LangOpts.CPlusPlus)
EXTENSION(cxx_explicit_conversions, LangOpts.CPlusPlus)
EXTENSION(cxx_inline_namespaces, LangOpts.CPlusPlus)
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -565,6 +565,9 @@
(`#63629 <https://github.com/llvm/llvm-project/issues/63629>`_)
- Fixed parsing of elaborated type specifier inside of a new expression.
(`#34341 <https://github.com/llvm/llvm-project/issues/34341>`_)
+- Clang now correctly evaluates ``__has_extension (cxx_defaulted_functions)``
+ and ``__has_extension (cxx_default_function_template_args)`` to 1.
+ (`#61758 <https://github.com/llvm/llvm-project/issues/61758>`_)
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154334.536714.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230703/9baf7825/attachment.bin>
More information about the cfe-commits
mailing list