Skip to content

[libc][NFC] Remove named_pair #73952

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
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions libc/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ add_header_library(
libc.src.__support.CPP.new
)

add_header_library(
named_pair
HDRS
named_pair.h
)

add_header_library(
common
HDRS
Expand All @@ -40,7 +34,6 @@ add_header_library(
HDRS
math_extras.h
DEPENDS
.named_pair
libc.src.__support.CPP.type_traits
libc.src.__support.macros.attributes
libc.src.__support.macros.config
Expand Down Expand Up @@ -185,7 +178,6 @@ add_header_library(
HDRS
number_pair.h
DEPENDS
.named_pair
libc.src.__support.CPP.type_traits
)

Expand Down
11 changes: 8 additions & 3 deletions libc/src/__support/math_extras.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_EXTRAS_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXTRAS_H

#include "named_pair.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN

namespace LIBC_NAMESPACE {

// Add with carry
DEFINE_NAMED_PAIR_TEMPLATE(SumCarry, sum, carry);
template <typename T> struct SumCarry {
T sum;
T carry;
};

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

// Subtract with borrow
DEFINE_NAMED_PAIR_TEMPLATE(DiffBorrow, diff, borrow);
template <typename T> struct DiffBorrow {
T diff;
T borrow;
};

// This version is always valid for constexpr.
template <typename T>
Expand Down
18 changes: 0 additions & 18 deletions libc/src/__support/named_pair.h

This file was deleted.

6 changes: 4 additions & 2 deletions libc/src/__support/number_pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
#define LLVM_LIBC_SRC___SUPPORT_NUMBER_PAIR_H

#include "CPP/type_traits.h"
#include "named_pair.h"

#include <stddef.h>

namespace LIBC_NAMESPACE {

DEFINE_NAMED_PAIR_TEMPLATE(NumberPair, lo, hi);
template <typename T> struct NumberPair {
T lo;
T hi;
};

template <typename T>
cpp::enable_if_t<cpp::is_integral_v<T> && cpp::is_unsigned_v<T>, NumberPair<T>>
Expand Down
7 changes: 0 additions & 7 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ libc_support_library(
hdrs = ["src/__support/number_pair.h"],
deps = [
":__support_cpp_type_traits",
":__support_named_pair",
],
)

Expand Down Expand Up @@ -587,11 +586,6 @@ libc_support_library(
],
)

libc_support_library(
name = "__support_named_pair",
hdrs = ["src/__support/named_pair.h"],
)

libc_support_library(
name = "__support_bit",
hdrs = ["src/__support/bit.h"],
Expand All @@ -608,7 +602,6 @@ libc_support_library(
":__support_cpp_type_traits",
":__support_macros_attributes",
":__support_macros_config",
":__support_named_pair",
],
)

Expand Down