Skip to content

Commit b793280

Browse files
committed
[libc++] Moves unwrap_reference to type_traits.
This was discovered while working on modules. Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D149351
1 parent f46b0e6 commit b793280

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ set(files
395395
__functional/reference_wrapper.h
396396
__functional/unary_function.h
397397
__functional/unary_negate.h
398-
__functional/unwrap_ref.h
399398
__functional/weak_result_type.h
400399
__fwd/array.h
401400
__fwd/fstream.h
@@ -792,6 +791,7 @@ set(files
792791
__type_traits/type_identity.h
793792
__type_traits/type_list.h
794793
__type_traits/underlying_type.h
794+
__type_traits/unwrap_ref.h
795795
__type_traits/void_t.h
796796
__undef_macros
797797
__utility/as_const.h

libcxx/include/__functional/unwrap_ref.h renamed to libcxx/include/__type_traits/unwrap_ref.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef _LIBCPP___FUNCTIONAL_UNWRAP_REF_H
10-
#define _LIBCPP___FUNCTIONAL_UNWRAP_REF_H
9+
#ifndef _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H
10+
#define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H
1111

1212
#include <__config>
1313
#include <__type_traits/decay.h>
@@ -42,7 +42,7 @@ struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { };
4242

4343
template <class _Tp>
4444
using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
45-
#endif // > C++17
45+
#endif // _LIBCPP_STD_VER >= 20
4646

4747
template <class _Tp>
4848
struct __unwrap_ref_decay
@@ -55,4 +55,4 @@ struct __unwrap_ref_decay
5555

5656
_LIBCPP_END_NAMESPACE_STD
5757

58-
#endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H
58+
#endif // _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H

libcxx/include/__utility/pair.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <__compare/synth_three_way.h>
1414
#include <__concepts/different_from.h>
1515
#include <__config>
16-
#include <__functional/unwrap_ref.h>
1716
#include <__fwd/array.h>
1817
#include <__fwd/get.h>
1918
#include <__fwd/subrange.h>
@@ -45,6 +44,7 @@
4544
#include <__type_traits/is_swappable.h>
4645
#include <__type_traits/nat.h>
4746
#include <__type_traits/remove_cvref.h>
47+
#include <__type_traits/unwrap_ref.h>
4848
#include <__utility/declval.h>
4949
#include <__utility/forward.h>
5050
#include <__utility/move.h>

libcxx/include/functional

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
541541
#include <__functional/reference_wrapper.h>
542542
#include <__functional/unary_function.h>
543543
#include <__functional/unary_negate.h>
544-
#include <__functional/unwrap_ref.h>
544+
#include <__type_traits/unwrap_ref.h>
545545
#include <__utility/forward.h>
546546
#include <memory> // TODO: find out why removing this breaks the modules build
547547
#include <typeinfo>

libcxx/include/module.modulemap.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,8 @@ module std [system] {
977977
}
978978
module functional {
979979
header "functional"
980+
// the contents of __type_traits/unwrap_ref.h should be available from functional too.
981+
export type_traits.unwrap_ref
980982
export *
981983

982984
module __functional {
@@ -1010,7 +1012,6 @@ module std [system] {
10101012
module reference_wrapper { private header "__functional/reference_wrapper.h" }
10111013
module unary_function { private header "__functional/unary_function.h" }
10121014
module unary_negate { private header "__functional/unary_negate.h" }
1013-
module unwrap_ref { private header "__functional/unwrap_ref.h" }
10141015
module weak_result_type { private header "__functional/weak_result_type.h" }
10151016
}
10161017
}
@@ -1521,7 +1522,6 @@ module std [system] {
15211522
}
15221523
module type_traits {
15231524
header "type_traits"
1524-
export functional.__functional.unwrap_ref
15251525
export *
15261526

15271527
module add_const { private header "__type_traits/add_const.h" }
@@ -1682,6 +1682,7 @@ module std [system] {
16821682

16831683
export type_traits
16841684
}
1685+
module unwrap_ref { private header "__type_traits/unwrap_ref.h" }
16851686
module void_t { private header "__type_traits/void_t.h" }
16861687
}
16871688
module typeindex {

libcxx/include/tuple

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ template <class... Types>
206206
#include <__compare/synth_three_way.h>
207207
#include <__config>
208208
#include <__functional/invoke.h>
209-
#include <__functional/unwrap_ref.h>
210209
#include <__fwd/array.h>
211210
#include <__fwd/tuple.h>
212211
#include <__memory/allocator_arg_t.h>
@@ -252,6 +251,7 @@ template <class... Types>
252251
#include <__type_traits/negation.h>
253252
#include <__type_traits/remove_cvref.h>
254253
#include <__type_traits/remove_reference.h>
254+
#include <__type_traits/unwrap_ref.h>
255255
#include <__utility/forward.h>
256256
#include <__utility/integer_sequence.h>
257257
#include <__utility/move.h>

libcxx/include/type_traits

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ namespace std
532532
#include <__type_traits/result_of.h>
533533
#include <__type_traits/type_identity.h>
534534
#include <__type_traits/underlying_type.h>
535+
#include <__type_traits/unwrap_ref.h>
535536
#include <__type_traits/void_t.h>
536537
#include <__utility/declval.h>
537538
#include <cstddef>

libcxx/test/libcxx/private_headers.verify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ END-SCRIPT
431431
#include <__functional/reference_wrapper.h> // expected-error@*:* {{use of private header from outside its module: '__functional/reference_wrapper.h'}}
432432
#include <__functional/unary_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_function.h'}}
433433
#include <__functional/unary_negate.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_negate.h'}}
434-
#include <__functional/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unwrap_ref.h'}}
435434
#include <__functional/weak_result_type.h> // expected-error@*:* {{use of private header from outside its module: '__functional/weak_result_type.h'}}
436435
#include <__fwd/array.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/array.h'}}
437436
#include <__fwd/fstream.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/fstream.h'}}
@@ -776,6 +775,7 @@ END-SCRIPT
776775
#include <__type_traits/type_identity.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_identity.h'}}
777776
#include <__type_traits/type_list.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_list.h'}}
778777
#include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.h'}}
778+
#include <__type_traits/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/unwrap_ref.h'}}
779779
#include <__type_traits/void_t.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/void_t.h'}}
780780
#include <__utility/as_const.h> // expected-error@*:* {{use of private header from outside its module: '__utility/as_const.h'}}
781781
#include <__utility/auto_cast.h> // expected-error@*:* {{use of private header from outside its module: '__utility/auto_cast.h'}}

libcxx/utils/data/ignore_format.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ libcxx/include/__functional/ranges_operations.h
394394
libcxx/include/__functional/reference_wrapper.h
395395
libcxx/include/__functional/unary_function.h
396396
libcxx/include/__functional/unary_negate.h
397-
libcxx/include/__functional/unwrap_ref.h
398397
libcxx/include/__functional/weak_result_type.h
399398
libcxx/include/future
400399
libcxx/include/__fwd/get.h
@@ -757,6 +756,7 @@ libcxx/include/__type_traits/strip_signature.h
757756
libcxx/include/__type_traits/type_identity.h
758757
libcxx/include/__type_traits/type_list.h
759758
libcxx/include/__type_traits/underlying_type.h
759+
libcxx/include/__type_traits/unwrap_ref.h
760760
libcxx/include/__type_traits/void_t.h
761761
libcxx/include/uchar.h
762762
libcxx/include/unordered_map

0 commit comments

Comments
 (0)