[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:06:28 PDT 2023


Fznamznon updated this revision to Diff 536715.
Fznamznon added a comment.

Fix test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154334/new/

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_default_function_template_args
+#if __has_extension(cxx_default_function_template_args)
+int has_default_function_template_args();
+#endif
+
+// CHECK: has_defaulted_functions
+#if __has_extension(cxx_defaulted_functions)
+int has_defaulted_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.536715.patch
Type: text/x-patch
Size: 1999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230703/9dce6caf/attachment-0001.bin>


More information about the cfe-commits mailing list