-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-libc Author: Guillaume Chatelet (gchatelet) ChangesFull diff: https://github.com/llvm/llvm-project/pull/73952.diff 5 Files Affected:
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index a76b22960f5a504..d41a9339b17a9df 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -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
@@ -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
@@ -185,7 +178,6 @@ add_header_library(
HDRS
number_pair.h
DEPENDS
- .named_pair
libc.src.__support.CPP.type_traits
)
diff --git a/libc/src/__support/math_extras.h b/libc/src/__support/math_extras.h
index cc22aa49d02601b..860cdda8586d1ea 100644
--- a/libc/src/__support/math_extras.h
+++ b/libc/src/__support/math_extras.h
@@ -10,7 +10,6 @@
#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
@@ -18,7 +17,10 @@
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>
@@ -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>
diff --git a/libc/src/__support/named_pair.h b/libc/src/__support/named_pair.h
deleted file mode 100644
index bd7dccf9810c7f7..000000000000000
--- a/libc/src/__support/named_pair.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Utilities for pairs of numbers. -------------------------*- C++ -*-===//
-//
-// 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 LLVM_LIBC_SRC___SUPPORT_NAMED_PAIR_H
-#define LLVM_LIBC_SRC___SUPPORT_NAMED_PAIR_H
-
-#define DEFINE_NAMED_PAIR_TEMPLATE(Name, FirstField, SecondField) \
- template <typename T1, typename T2 = T1> struct Name { \
- T1 FirstField; \
- T2 SecondField; \
- }
-
-#endif // LLVM_LIBC_SRC___SUPPORT_NAMED_PAIR_H
diff --git a/libc/src/__support/number_pair.h b/libc/src/__support/number_pair.h
index 5e553d817994b4b..12e730836af2c67 100644
--- a/libc/src/__support/number_pair.h
+++ b/libc/src/__support/number_pair.h
@@ -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>>
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index a0a6a4366ea7537..2f9f5a4f90efc00 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -431,7 +431,6 @@ libc_support_library(
hdrs = ["src/__support/number_pair.h"],
deps = [
":__support_cpp_type_traits",
- ":__support_named_pair",
],
)
@@ -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"],
@@ -608,7 +602,6 @@ libc_support_library(
":__support_cpp_type_traits",
":__support_macros_attributes",
":__support_macros_config",
- ":__support_named_pair",
],
)
|
nickdesaulniers
approved these changes
Nov 30, 2023
lntue
approved these changes
Nov 30, 2023
michaelrj-google
approved these changes
Nov 30, 2023
asb
added a commit
to asb/llvm-project
that referenced
this pull request
Dec 5, 2023
…ructions Follows llvm#73952 doing the same thing for the nneg flag on zext.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
named_pair
does not provide enough value to deserve its own header.