Skip to content

[libc++] Merge is_scoped_enum.h into is_enum.h #99458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

philnik777
Copy link
Contributor

No description provided.

@philnik777 philnik777 requested a review from a team as a code owner July 18, 2024 09:14
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 18, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/99458.diff

5 Files Affected:

  • (modified) libcxx/include/CMakeLists.txt (-1)
  • (modified) libcxx/include/__type_traits/is_enum.h (+10)
  • (removed) libcxx/include/__type_traits/is_scoped_enum.h (-33)
  • (modified) libcxx/include/module.modulemap (-1)
  • (modified) libcxx/include/type_traits (-4)
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index cd64fe91449c2..26bad4f656a07 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -793,7 +793,6 @@ set(files
   __type_traits/is_referenceable.h
   __type_traits/is_same.h
   __type_traits/is_scalar.h
-  __type_traits/is_scoped_enum.h
   __type_traits/is_signed.h
   __type_traits/is_signed_integer.h
   __type_traits/is_specialization.h
diff --git a/libcxx/include/__type_traits/is_enum.h b/libcxx/include/__type_traits/is_enum.h
index 77ca3ea108742..2fab6db2c8d50 100644
--- a/libcxx/include/__type_traits/is_enum.h
+++ b/libcxx/include/__type_traits/is_enum.h
@@ -26,6 +26,16 @@ template <class _Tp>
 inline constexpr bool is_enum_v = __is_enum(_Tp);
 #endif
 
+#if _LIBCPP_STD_VER >= 23
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {};
+
+template <class _Tp>
+inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
+
+#endif // _LIBCPP_STD_VER >= 23
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif // _LIBCPP___TYPE_TRAITS_IS_ENUM_H
diff --git a/libcxx/include/__type_traits/is_scoped_enum.h b/libcxx/include/__type_traits/is_scoped_enum.h
deleted file mode 100644
index cb3e25cf57331..0000000000000
--- a/libcxx/include/__type_traits/is_scoped_enum.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H
-#define _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H
-
-#include <__config>
-#include <__type_traits/integral_constant.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {};
-
-template <class _Tp>
-inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 7608aef3f3a43..5ed284d80f35e 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -2009,7 +2009,6 @@ module std_private_type_traits_is_scalar                                 [system
   header "__type_traits/is_scalar.h"
   export std_private_type_traits_is_null_pointer
 }
-module std_private_type_traits_is_scoped_enum                            [system] { header "__type_traits/is_scoped_enum.h" }
 module std_private_type_traits_is_signed                                 [system] { header "__type_traits/is_signed.h" }
 module std_private_type_traits_is_signed_integer                         [system] { header "__type_traits/is_signed_integer.h" }
 module std_private_type_traits_is_specialization                         [system] { header "__type_traits/is_specialization.h" }
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index ffa137338b6a2..7f231cd09df51 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -514,10 +514,6 @@ namespace std
 #  include <__type_traits/unwrap_ref.h>
 #endif
 
-#if _LIBCPP_STD_VER >= 23
-#  include <__type_traits/is_scoped_enum.h>
-#endif
-
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

@philnik777 philnik777 merged commit 4dfa75c into llvm:main Jul 18, 2024
57 of 59 checks passed
@philnik777 philnik777 deleted the merge_is_scoped_enum branch July 18, 2024 13:17
@mordante
Copy link
Member

This patch has no description so I've no idea why this was done. Can you explain why this was done.
I really like some motivation for patches that not obvious why they are done. This really helps when looking at the commit history to understand the reasons why something was done.

@ldionne
Copy link
Member

ldionne commented Jul 23, 2024

My understanding is that this is only to reduce the number of small headers now that the definition of the trait is near trivial. I agree a one-line justification in the patch would help, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants