Skip to content

Commit bb98227

Browse files
authored
[libc][NFC] Remove named_pair (llvm#73952)
`named_pair` does not provide enough value to deserve its own header.
1 parent 4d1dc77 commit bb98227

File tree

5 files changed

+12
-38
lines changed

5 files changed

+12
-38
lines changed

libc/src/__support/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ add_header_library(
1010
libc.src.__support.CPP.new
1111
)
1212

13-
add_header_library(
14-
named_pair
15-
HDRS
16-
named_pair.h
17-
)
18-
1913
add_header_library(
2014
common
2115
HDRS
@@ -40,7 +34,6 @@ add_header_library(
4034
HDRS
4135
math_extras.h
4236
DEPENDS
43-
.named_pair
4437
libc.src.__support.CPP.type_traits
4538
libc.src.__support.macros.attributes
4639
libc.src.__support.macros.config
@@ -187,7 +180,6 @@ add_header_library(
187180
HDRS
188181
number_pair.h
189182
DEPENDS
190-
.named_pair
191183
libc.src.__support.CPP.type_traits
192184
)
193185

libc/src/__support/math_extras.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_EXTRAS_H
1111
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXTRAS_H
1212

13-
#include "named_pair.h"
1413
#include "src/__support/CPP/type_traits.h"
1514
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1615
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
1716

1817
namespace LIBC_NAMESPACE {
1918

2019
// Add with carry
21-
DEFINE_NAMED_PAIR_TEMPLATE(SumCarry, sum, carry);
20+
template <typename T> struct SumCarry {
21+
T sum;
22+
T carry;
23+
};
2224

2325
// This version is always valid for constexpr.
2426
template <typename T>
@@ -91,7 +93,10 @@ add_with_carry<unsigned long long>(unsigned long long a, unsigned long long b,
9193
#endif // LIBC_HAS_BUILTIN(__builtin_addc)
9294

9395
// Subtract with borrow
94-
DEFINE_NAMED_PAIR_TEMPLATE(DiffBorrow, diff, borrow);
96+
template <typename T> struct DiffBorrow {
97+
T diff;
98+
T borrow;
99+
};
95100

96101
// This version is always valid for constexpr.
97102
template <typename T>

libc/src/__support/named_pair.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

libc/src/__support/number_pair.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#define LLVM_LIBC_SRC___SUPPORT_NUMBER_PAIR_H
1111

1212
#include "CPP/type_traits.h"
13-
#include "named_pair.h"
1413

1514
#include <stddef.h>
1615

1716
namespace LIBC_NAMESPACE {
1817

19-
DEFINE_NAMED_PAIR_TEMPLATE(NumberPair, lo, hi);
18+
template <typename T> struct NumberPair {
19+
T lo;
20+
T hi;
21+
};
2022

2123
template <typename T>
2224
cpp::enable_if_t<cpp::is_integral_v<T> && cpp::is_unsigned_v<T>, NumberPair<T>>

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ libc_support_library(
432432
hdrs = ["src/__support/number_pair.h"],
433433
deps = [
434434
":__support_cpp_type_traits",
435-
":__support_named_pair",
436435
],
437436
)
438437

@@ -587,11 +586,6 @@ libc_support_library(
587586
],
588587
)
589588

590-
libc_support_library(
591-
name = "__support_named_pair",
592-
hdrs = ["src/__support/named_pair.h"],
593-
)
594-
595589
libc_support_library(
596590
name = "__support_bit",
597591
hdrs = ["src/__support/bit.h"],
@@ -608,7 +602,6 @@ libc_support_library(
608602
":__support_cpp_type_traits",
609603
":__support_macros_attributes",
610604
":__support_macros_config",
611-
":__support_named_pair",
612605
],
613606
)
614607

0 commit comments

Comments
 (0)