1
1
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2
2
From: PJ Reiniger <
[email protected] >
3
3
Date: Sat, 7 May 2022 22:12:41 -0400
4
- Subject: [PATCH 02/36 ] Wrap std::min/max calls in parens, for Windows warnings
4
+ Subject: [PATCH 02/37 ] Wrap std::min/max calls in parens, for Windows warnings
5
5
6
6
---
7
7
llvm/include/llvm/ADT/DenseMap.h | 4 ++--
8
8
llvm/include/llvm/ADT/SmallVector.h | 6 +++---
9
9
llvm/include/llvm/Support/ConvertUTF.h | 2 +-
10
- llvm/include/llvm/Support/MathExtras.h | 18 +++++++++---------
11
- 4 files changed, 15 insertions(+), 15 deletions(-)
10
+ llvm/include/llvm/Support/MathExtras.h | 20 ++++++++++- ---------
11
+ 4 files changed, 16 insertions(+), 16 deletions(-)
12
12
13
13
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
14
- index 3ef6a7cd1b4b587e61fcb9475d9f3516018bf2ee..108193f04486425f3b7f039cd9d2004be6facafb 100644
14
+ index 7ccc9445c0a7b882b424b2431858ea596d0eb58f..c4764fffa845a7f9eb69f262aa0ee728d08b1655 100644
15
15
--- a/llvm/include/llvm/ADT/DenseMap.h
16
16
+++ b/llvm/include/llvm/ADT/DenseMap.h
17
- @@ -416 ,7 +416 ,7 @@ protected:
17
+ @@ -432 ,7 +432 ,7 @@ protected:
18
18
return 0;
19
19
// +1 is required because of the strict equality.
20
20
// For example if NumEntries is 48, we need to return 401.
@@ -23,7 +23,7 @@ index 3ef6a7cd1b4b587e61fcb9475d9f3516018bf2ee..108193f04486425f3b7f039cd9d2004b
23
23
}
24
24
25
25
void moveFromOldBuckets(BucketT *OldBucketsBegin, BucketT *OldBucketsEnd) {
26
- @@ -852 ,7 +852 ,7 @@ public:
26
+ @@ -868 ,7 +868 ,7 @@ public:
27
27
// Reduce the number of buckets.
28
28
unsigned NewNumBuckets = 0;
29
29
if (OldNumEntries)
@@ -33,10 +33,10 @@ index 3ef6a7cd1b4b587e61fcb9475d9f3516018bf2ee..108193f04486425f3b7f039cd9d2004b
33
33
this->BaseT::initEmpty();
34
34
return;
35
35
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
36
- index c96fd0e4956ee6d586f85dc79623de137e781ce0..d7600fe209a58deb07c63e2553f9dad62e06e973 100644
36
+ index 94d8da059f4f8bad50039b0d0b7993396707829c..85bf5172e419b1b58f53d3cf00d4aabb58877c33 100644
37
37
--- a/llvm/include/llvm/ADT/SmallVector.h
38
38
+++ b/llvm/include/llvm/ADT/SmallVector.h
39
- @@ -55 ,7 +55 ,7 @@ protected:
39
+ @@ -56 ,7 +56 ,7 @@ protected:
40
40
41
41
/// The maximum value of the Size_T used.
42
42
static constexpr size_t SizeTypeMax() {
@@ -45,7 +45,7 @@ index c96fd0e4956ee6d586f85dc79623de137e781ce0..d7600fe209a58deb07c63e2553f9dad6
45
45
}
46
46
47
47
SmallVectorBase() = delete;
48
- @@ -289 ,7 +289 ,7 @@ public:
48
+ @@ -290 ,7 +290 ,7 @@ public:
49
49
50
50
size_type size_in_bytes() const { return size() * sizeof(T); }
51
51
size_type max_size() const {
@@ -54,7 +54,7 @@ index c96fd0e4956ee6d586f85dc79623de137e781ce0..d7600fe209a58deb07c63e2553f9dad6
54
54
}
55
55
56
56
size_t capacity_in_bytes() const { return capacity() * sizeof(T); }
57
- @@ -721 ,7 +721 ,7 @@ public:
57
+ @@ -722 ,7 +722 ,7 @@ public:
58
58
}
59
59
60
60
// Assign over existing elements.
@@ -77,10 +77,10 @@ index 5c0e3009c25446a34882fb98329b1d955231bb39..72321022beb373945f7935ed72944fd6
77
77
/* Some fundamental constants */
78
78
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
79
79
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
80
- index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c91ba725d 100644
80
+ index e568e42afcf4d20dba137346953ff4be9d27ffc7..d9de2e92d5b07bce1d02ffcfda614b9079d2df91 100644
81
81
--- a/llvm/include/llvm/Support/MathExtras.h
82
82
+++ b/llvm/include/llvm/Support/MathExtras.h
83
- @@ -311 ,26 +311 ,26 @@ template <> constexpr inline size_t CTLog2<1>() { return 0; }
83
+ @@ -338 ,26 +338 ,26 @@ template <> constexpr size_t CTLog2<1>() { return 0; }
84
84
/// (32 bit edition.)
85
85
/// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2
86
86
inline unsigned Log2_32(uint32_t Value) {
@@ -111,7 +111,16 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
111
111
}
112
112
113
113
/// A and B are either alignments or offsets. Return the minimum alignment that
114
- @@ -482,7 +482,7 @@ SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
114
+ @@ -417,7 +417,7 @@ constexpr uint64_t divideCeil(uint64_t Numerator, uint64_t Denominator) {
115
+ // happens only when Numerator = INT_MIN and Denominator = -1.
116
+ template <typename U, typename V>
117
+ constexpr bool divideSignedWouldOverflow(U Numerator, V Denominator) {
118
+ - return Numerator == std::numeric_limits<U>::min() && Denominator == -1;
119
+ + return Numerator == (std::numeric_limits<U>::min)() && Denominator == -1;
120
+ }
121
+
122
+ /// Returns the integer ceil(Numerator / Denominator). Signed version.
123
+ @@ -605,7 +605,7 @@ SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
115
124
T Z = X + Y;
116
125
Overflowed = (Z < X || Z < Y);
117
126
if (Overflowed)
@@ -120,7 +129,7 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
120
129
else
121
130
return Z;
122
131
}
123
- @@ -495 ,7 +495 ,7 @@ std::enable_if_t<std::is_unsigned_v<T>, T> SaturatingAdd(T X, T Y, T Z,
132
+ @@ -618 ,7 +618 ,7 @@ std::enable_if_t<std::is_unsigned_v<T>, T> SaturatingAdd(T X, T Y, T Z,
124
133
bool Overflowed = false;
125
134
T XY = SaturatingAdd(X, Y, &Overflowed);
126
135
if (Overflowed)
@@ -129,7 +138,7 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
129
138
return SaturatingAdd(XY, Z, Args...);
130
139
}
131
140
132
- @@ -519 ,7 +519 ,7 @@ SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
141
+ @@ -642 ,7 +642 ,7 @@ SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
133
142
// Special case: if X or Y is 0, Log2_64 gives -1, and Log2Z
134
143
// will necessarily be less than Log2Max as desired.
135
144
int Log2Z = Log2_64(X) + Log2_64(Y);
@@ -138,7 +147,7 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
138
147
int Log2Max = Log2_64(Max);
139
148
if (Log2Z < Log2Max) {
140
149
return X * Y;
141
- @@ -639 ,9 +639 ,9 @@ std::enable_if_t<std::is_signed_v<T>, T> MulOverflow(T X, T Y, T &Result) {
150
+ @@ -764 ,9 +764 ,9 @@ std::enable_if_t<std::is_signed_v<T>, T> MulOverflow(T X, T Y, T &Result) {
142
151
// Check how the max allowed absolute value (2^n for negative, 2^(n-1) for
143
152
// positive) divided by an argument compares to the other.
144
153
if (IsNegative)
@@ -147,6 +156,6 @@ index aa4f4d2ed42e262f27e3f7f5ce275baf7e556c2d..5cabfdd6493fee33fbc74b831dc1fa3c
147
156
else
148
157
- return UX > (static_cast<U>(std::numeric_limits<T>::max())) / UY;
149
158
+ return UX > (static_cast<U>((std::numeric_limits<T>::max)())) / UY;
159
+ #endif
150
160
}
151
161
152
- } // End llvm namespace
0 commit comments