From b8ff3fcee2cc81e0f22785ca74f9fca4082390b2 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Wed, 25 Sep 2024 01:11:41 -0400 Subject: [PATCH] [upstream_utils] StringMap: fix structured bindings with move-only types (#7127) --- ...move-StringRef-ArrayRef-and-Optional.patch | 2 +- ...-calls-in-parens-for-Windows-warning.patch | 2 +- ...-Change-unique_function-storage-size.patch | 2 +- .../llvm_patches/0004-Threading-updates.patch | 2 +- .../0005-ifdef-guard-safety.patch | 2 +- .../0006-Explicitly-use-std.patch | 2 +- .../0007-Remove-format_provider.patch | 2 +- .../0008-Add-compiler-warning-pragmas.patch | 2 +- .../0009-Remove-unused-functions.patch | 2 +- .../0010-Detemplatize-SmallVectorBase.patch | 2 +- .../0011-Add-vectors-to-raw_ostream.patch | 2 +- .../0012-Extra-collections-features.patch | 2 +- .../0013-EpochTracker-ABI-macro.patch | 2 +- .../0014-Delete-numbers-from-MathExtras.patch | 2 +- .../llvm_patches/0015-Add-lerp-and-sgn.patch | 2 +- .../llvm_patches/0016-Fixup-includes.patch | 2 +- ...-std-is_trivially_copy_constructible.patch | 2 +- .../llvm_patches/0018-Windows-support.patch | 2 +- .../llvm_patches/0019-Prefer-fmtlib.patch | 2 +- .../llvm_patches/0020-Prefer-wpi-s-fs.h.patch | 2 +- .../0021-Remove-unused-functions.patch | 2 +- .../0022-OS-specific-changes.patch | 2 +- ...3-Use-SmallVector-for-UTF-conversion.patch | 2 +- ...o-use-static-pointers-in-raw_ostream.patch | 2 +- .../0025-constexpr-endian-byte-swap.patch | 2 +- ...-from-STLExtras.h-into-PointerUnion..patch | 2 +- ...-Remove-StringMap-test-for-llvm-sort.patch | 2 +- ...0028-Unused-variable-in-release-mode.patch | 2 +- .../0029-Use-C-20-bit-header.patch | 2 +- ...0-Remove-DenseMap-GTest-printer-test.patch | 2 +- ...ace-deprecated-std-aligned_storage_t.patch | 2 +- ...-raw_ostream-Add-SetNumBytesInBuffer.patch | 2 +- .../0033-type_traits.h-Add-is_constexpr.patch | 2 +- ...emoved-raw_string_ostream-write_impl.patch | 2 +- ...ove-auto-conversion-from-raw_ostream.patch | 2 +- .../0036-Add-SmallVector-erase_if.patch | 2 +- ...7-Fix-AlignedCharArrayUnion-for-C-23.patch | 2 +- ...ructured-bindings-with-move-only-typ.patch | 54 +++++++++++++++++++ .../llvm/include/wpi/StringMapEntry.h | 12 ++++- .../test/native/cpp/llvm/StringMapTest.cpp | 10 ++++ 40 files changed, 112 insertions(+), 38 deletions(-) create mode 100644 upstream_utils/llvm_patches/0038-StringMap-fix-structured-bindings-with-move-only-typ.patch diff --git a/upstream_utils/llvm_patches/0001-Remove-StringRef-ArrayRef-and-Optional.patch b/upstream_utils/llvm_patches/0001-Remove-StringRef-ArrayRef-and-Optional.patch index a1c558bcb3..b4c1512195 100644 --- a/upstream_utils/llvm_patches/0001-Remove-StringRef-ArrayRef-and-Optional.patch +++ b/upstream_utils/llvm_patches/0001-Remove-StringRef-ArrayRef-and-Optional.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:09:18 -0400 -Subject: [PATCH 01/37] Remove StringRef, ArrayRef, and Optional +Subject: [PATCH 01/38] Remove StringRef, ArrayRef, and Optional --- llvm/include/llvm/ADT/PointerUnion.h | 1 - diff --git a/upstream_utils/llvm_patches/0002-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch b/upstream_utils/llvm_patches/0002-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch index 51b7215c2c..8bf413f44f 100644 --- a/upstream_utils/llvm_patches/0002-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch +++ b/upstream_utils/llvm_patches/0002-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:12:41 -0400 -Subject: [PATCH 02/37] Wrap std::min/max calls in parens, for Windows warnings +Subject: [PATCH 02/38] Wrap std::min/max calls in parens, for Windows warnings --- llvm/include/llvm/ADT/DenseMap.h | 4 ++-- diff --git a/upstream_utils/llvm_patches/0003-Change-unique_function-storage-size.patch b/upstream_utils/llvm_patches/0003-Change-unique_function-storage-size.patch index dfc643346e..ab7ab706bc 100644 --- a/upstream_utils/llvm_patches/0003-Change-unique_function-storage-size.patch +++ b/upstream_utils/llvm_patches/0003-Change-unique_function-storage-size.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:13:55 -0400 -Subject: [PATCH 03/37] Change unique_function storage size +Subject: [PATCH 03/38] Change unique_function storage size --- llvm/include/llvm/ADT/FunctionExtras.h | 4 ++-- diff --git a/upstream_utils/llvm_patches/0004-Threading-updates.patch b/upstream_utils/llvm_patches/0004-Threading-updates.patch index cee1b2eb6d..56c31c5934 100644 --- a/upstream_utils/llvm_patches/0004-Threading-updates.patch +++ b/upstream_utils/llvm_patches/0004-Threading-updates.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:17:19 -0400 -Subject: [PATCH 04/37] Threading updates +Subject: [PATCH 04/38] Threading updates - Remove guards for threads and exception - Prefer scope gaurd over lock gaurd diff --git a/upstream_utils/llvm_patches/0005-ifdef-guard-safety.patch b/upstream_utils/llvm_patches/0005-ifdef-guard-safety.patch index fcb8e5c373..f03d7633c3 100644 --- a/upstream_utils/llvm_patches/0005-ifdef-guard-safety.patch +++ b/upstream_utils/llvm_patches/0005-ifdef-guard-safety.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:28:13 -0400 -Subject: [PATCH 05/37] \#ifdef guard safety +Subject: [PATCH 05/38] \#ifdef guard safety Prevents redefinition if someone is pulling in real LLVM, since the macros are in global namespace --- diff --git a/upstream_utils/llvm_patches/0006-Explicitly-use-std.patch b/upstream_utils/llvm_patches/0006-Explicitly-use-std.patch index 2f8ee1aafa..04e4c6a739 100644 --- a/upstream_utils/llvm_patches/0006-Explicitly-use-std.patch +++ b/upstream_utils/llvm_patches/0006-Explicitly-use-std.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:37:34 -0400 -Subject: [PATCH 06/37] Explicitly use std:: +Subject: [PATCH 06/38] Explicitly use std:: --- llvm/include/llvm/ADT/SmallSet.h | 2 +- diff --git a/upstream_utils/llvm_patches/0007-Remove-format_provider.patch b/upstream_utils/llvm_patches/0007-Remove-format_provider.patch index dc76e10c8d..ad565c536e 100644 --- a/upstream_utils/llvm_patches/0007-Remove-format_provider.patch +++ b/upstream_utils/llvm_patches/0007-Remove-format_provider.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sat, 7 May 2022 22:53:50 -0400 -Subject: [PATCH 07/37] Remove format_provider +Subject: [PATCH 07/38] Remove format_provider --- llvm/include/llvm/Support/Chrono.h | 114 ------------------------ diff --git a/upstream_utils/llvm_patches/0008-Add-compiler-warning-pragmas.patch b/upstream_utils/llvm_patches/0008-Add-compiler-warning-pragmas.patch index a325299c07..fce8b82807 100644 --- a/upstream_utils/llvm_patches/0008-Add-compiler-warning-pragmas.patch +++ b/upstream_utils/llvm_patches/0008-Add-compiler-warning-pragmas.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 13:34:07 -0400 -Subject: [PATCH 08/37] Add compiler warning pragmas +Subject: [PATCH 08/38] Add compiler warning pragmas --- llvm/include/llvm/ADT/FunctionExtras.h | 11 +++++++++++ diff --git a/upstream_utils/llvm_patches/0009-Remove-unused-functions.patch b/upstream_utils/llvm_patches/0009-Remove-unused-functions.patch index 110c273bdf..7b99fa5d92 100644 --- a/upstream_utils/llvm_patches/0009-Remove-unused-functions.patch +++ b/upstream_utils/llvm_patches/0009-Remove-unused-functions.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 13:43:50 -0400 -Subject: [PATCH 09/37] Remove unused functions +Subject: [PATCH 09/38] Remove unused functions --- llvm/include/llvm/ADT/SmallString.h | 79 ------ diff --git a/upstream_utils/llvm_patches/0010-Detemplatize-SmallVectorBase.patch b/upstream_utils/llvm_patches/0010-Detemplatize-SmallVectorBase.patch index a05d7019a8..c4ed938400 100644 --- a/upstream_utils/llvm_patches/0010-Detemplatize-SmallVectorBase.patch +++ b/upstream_utils/llvm_patches/0010-Detemplatize-SmallVectorBase.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Thu, 5 May 2022 23:18:34 -0400 -Subject: [PATCH 10/37] Detemplatize SmallVectorBase +Subject: [PATCH 10/38] Detemplatize SmallVectorBase --- llvm/include/llvm/ADT/SmallVector.h | 35 ++++++++++----------------- diff --git a/upstream_utils/llvm_patches/0011-Add-vectors-to-raw_ostream.patch b/upstream_utils/llvm_patches/0011-Add-vectors-to-raw_ostream.patch index 6d45796efd..82ac7bfaf0 100644 --- a/upstream_utils/llvm_patches/0011-Add-vectors-to-raw_ostream.patch +++ b/upstream_utils/llvm_patches/0011-Add-vectors-to-raw_ostream.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 13:48:59 -0400 -Subject: [PATCH 11/37] Add vectors to raw_ostream +Subject: [PATCH 11/38] Add vectors to raw_ostream --- llvm/include/llvm/Support/raw_ostream.h | 115 ++++++++++++++++++++++++ diff --git a/upstream_utils/llvm_patches/0012-Extra-collections-features.patch b/upstream_utils/llvm_patches/0012-Extra-collections-features.patch index 2d4243eae7..1f32c604c2 100644 --- a/upstream_utils/llvm_patches/0012-Extra-collections-features.patch +++ b/upstream_utils/llvm_patches/0012-Extra-collections-features.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 3 May 2022 22:16:10 -0400 -Subject: [PATCH 12/37] Extra collections features +Subject: [PATCH 12/38] Extra collections features --- llvm/include/llvm/ADT/StringMap.h | 103 +++++++++++++++++++++++++++++- diff --git a/upstream_utils/llvm_patches/0013-EpochTracker-ABI-macro.patch b/upstream_utils/llvm_patches/0013-EpochTracker-ABI-macro.patch index 7f74ecd937..9e03b73391 100644 --- a/upstream_utils/llvm_patches/0013-EpochTracker-ABI-macro.patch +++ b/upstream_utils/llvm_patches/0013-EpochTracker-ABI-macro.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Wed, 4 May 2022 00:01:00 -0400 -Subject: [PATCH 13/37] EpochTracker ABI macro +Subject: [PATCH 13/38] EpochTracker ABI macro --- llvm/include/llvm/ADT/EpochTracker.h | 2 +- diff --git a/upstream_utils/llvm_patches/0014-Delete-numbers-from-MathExtras.patch b/upstream_utils/llvm_patches/0014-Delete-numbers-from-MathExtras.patch index a896f9b084..4a5858f54e 100644 --- a/upstream_utils/llvm_patches/0014-Delete-numbers-from-MathExtras.patch +++ b/upstream_utils/llvm_patches/0014-Delete-numbers-from-MathExtras.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Thu, 5 May 2022 18:09:45 -0400 -Subject: [PATCH 14/37] Delete numbers from MathExtras +Subject: [PATCH 14/38] Delete numbers from MathExtras --- llvm/include/llvm/Support/MathExtras.h | 36 -------------------------- diff --git a/upstream_utils/llvm_patches/0015-Add-lerp-and-sgn.patch b/upstream_utils/llvm_patches/0015-Add-lerp-and-sgn.patch index 4612f614f2..71015dc78f 100644 --- a/upstream_utils/llvm_patches/0015-Add-lerp-and-sgn.patch +++ b/upstream_utils/llvm_patches/0015-Add-lerp-and-sgn.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 3 May 2022 22:50:24 -0400 -Subject: [PATCH 15/37] Add lerp and sgn +Subject: [PATCH 15/38] Add lerp and sgn --- llvm/include/llvm/Support/MathExtras.h | 20 ++++++++++++++++++++ diff --git a/upstream_utils/llvm_patches/0016-Fixup-includes.patch b/upstream_utils/llvm_patches/0016-Fixup-includes.patch index cf04342f34..378b9b4598 100644 --- a/upstream_utils/llvm_patches/0016-Fixup-includes.patch +++ b/upstream_utils/llvm_patches/0016-Fixup-includes.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 16:38:11 -0400 -Subject: [PATCH 16/37] Fixup includes +Subject: [PATCH 16/38] Fixup includes --- llvm/include/llvm/ADT/StringMap.h | 4 ++++ diff --git a/upstream_utils/llvm_patches/0017-Use-std-is_trivially_copy_constructible.patch b/upstream_utils/llvm_patches/0017-Use-std-is_trivially_copy_constructible.patch index 40adf0eab9..a2e3b73681 100644 --- a/upstream_utils/llvm_patches/0017-Use-std-is_trivially_copy_constructible.patch +++ b/upstream_utils/llvm_patches/0017-Use-std-is_trivially_copy_constructible.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 16:42:09 -0400 -Subject: [PATCH 17/37] Use std::is_trivially_copy_constructible +Subject: [PATCH 17/38] Use std::is_trivially_copy_constructible --- llvm/include/llvm/Support/type_traits.h | 16 ---------------- diff --git a/upstream_utils/llvm_patches/0018-Windows-support.patch b/upstream_utils/llvm_patches/0018-Windows-support.patch index f9793cc69c..1ebecd096e 100644 --- a/upstream_utils/llvm_patches/0018-Windows-support.patch +++ b/upstream_utils/llvm_patches/0018-Windows-support.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 3 May 2022 20:22:38 -0400 -Subject: [PATCH 18/37] Windows support +Subject: [PATCH 18/38] Windows support --- .../llvm/Support/Windows/WindowsSupport.h | 45 +++++---- diff --git a/upstream_utils/llvm_patches/0019-Prefer-fmtlib.patch b/upstream_utils/llvm_patches/0019-Prefer-fmtlib.patch index 8995a7e32a..f31e60ce50 100644 --- a/upstream_utils/llvm_patches/0019-Prefer-fmtlib.patch +++ b/upstream_utils/llvm_patches/0019-Prefer-fmtlib.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 16:46:20 -0400 -Subject: [PATCH 19/37] Prefer fmtlib +Subject: [PATCH 19/38] Prefer fmtlib --- llvm/lib/Support/ErrorHandling.cpp | 20 ++++++-------------- diff --git a/upstream_utils/llvm_patches/0020-Prefer-wpi-s-fs.h.patch b/upstream_utils/llvm_patches/0020-Prefer-wpi-s-fs.h.patch index c8a6bd3c81..c2d54e64e0 100644 --- a/upstream_utils/llvm_patches/0020-Prefer-wpi-s-fs.h.patch +++ b/upstream_utils/llvm_patches/0020-Prefer-wpi-s-fs.h.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 16:49:36 -0400 -Subject: [PATCH 20/37] Prefer wpi's fs.h +Subject: [PATCH 20/38] Prefer wpi's fs.h --- llvm/include/llvm/Support/raw_ostream.h | 7 ++----- diff --git a/upstream_utils/llvm_patches/0021-Remove-unused-functions.patch b/upstream_utils/llvm_patches/0021-Remove-unused-functions.patch index ec263b299e..810f018c26 100644 --- a/upstream_utils/llvm_patches/0021-Remove-unused-functions.patch +++ b/upstream_utils/llvm_patches/0021-Remove-unused-functions.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 19:16:51 -0400 -Subject: [PATCH 21/37] Remove unused functions +Subject: [PATCH 21/38] Remove unused functions --- llvm/include/llvm/Support/raw_ostream.h | 5 +- diff --git a/upstream_utils/llvm_patches/0022-OS-specific-changes.patch b/upstream_utils/llvm_patches/0022-OS-specific-changes.patch index 1f0d611267..590d1703d1 100644 --- a/upstream_utils/llvm_patches/0022-OS-specific-changes.patch +++ b/upstream_utils/llvm_patches/0022-OS-specific-changes.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 19:30:43 -0400 -Subject: [PATCH 22/37] OS-specific changes +Subject: [PATCH 22/38] OS-specific changes --- llvm/lib/Support/ErrorHandling.cpp | 16 +++++++--------- diff --git a/upstream_utils/llvm_patches/0023-Use-SmallVector-for-UTF-conversion.patch b/upstream_utils/llvm_patches/0023-Use-SmallVector-for-UTF-conversion.patch index 84fc17c40b..080ae752cc 100644 --- a/upstream_utils/llvm_patches/0023-Use-SmallVector-for-UTF-conversion.patch +++ b/upstream_utils/llvm_patches/0023-Use-SmallVector-for-UTF-conversion.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Mon, 9 May 2022 00:04:30 -0400 -Subject: [PATCH 23/37] Use SmallVector for UTF conversion +Subject: [PATCH 23/38] Use SmallVector for UTF conversion --- llvm/include/llvm/Support/ConvertUTF.h | 6 +++--- diff --git a/upstream_utils/llvm_patches/0024-Prefer-to-use-static-pointers-in-raw_ostream.patch b/upstream_utils/llvm_patches/0024-Prefer-to-use-static-pointers-in-raw_ostream.patch index d37d60d4dd..7bf01d9f80 100644 --- a/upstream_utils/llvm_patches/0024-Prefer-to-use-static-pointers-in-raw_ostream.patch +++ b/upstream_utils/llvm_patches/0024-Prefer-to-use-static-pointers-in-raw_ostream.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Thu, 19 May 2022 00:58:36 -0400 -Subject: [PATCH 24/37] Prefer to use static pointers in raw_ostream +Subject: [PATCH 24/38] Prefer to use static pointers in raw_ostream See #1401 --- diff --git a/upstream_utils/llvm_patches/0025-constexpr-endian-byte-swap.patch b/upstream_utils/llvm_patches/0025-constexpr-endian-byte-swap.patch index 2770541a96..8b7b95589c 100644 --- a/upstream_utils/llvm_patches/0025-constexpr-endian-byte-swap.patch +++ b/upstream_utils/llvm_patches/0025-constexpr-endian-byte-swap.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Fri, 1 Mar 2024 11:56:17 -0800 -Subject: [PATCH 25/37] constexpr endian byte swap +Subject: [PATCH 25/38] constexpr endian byte swap --- llvm/include/llvm/Support/Endian.h | 4 +++- diff --git a/upstream_utils/llvm_patches/0026-Copy-type-traits-from-STLExtras.h-into-PointerUnion..patch b/upstream_utils/llvm_patches/0026-Copy-type-traits-from-STLExtras.h-into-PointerUnion..patch index 13bb23fde5..b7d90f2604 100644 --- a/upstream_utils/llvm_patches/0026-Copy-type-traits-from-STLExtras.h-into-PointerUnion..patch +++ b/upstream_utils/llvm_patches/0026-Copy-type-traits-from-STLExtras.h-into-PointerUnion..patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Wed, 10 Aug 2022 17:07:52 -0700 -Subject: [PATCH 26/37] Copy type traits from STLExtras.h into PointerUnion.h +Subject: [PATCH 26/38] Copy type traits from STLExtras.h into PointerUnion.h --- llvm/include/llvm/ADT/PointerUnion.h | 46 ++++++++++++++++++++++++++++ diff --git a/upstream_utils/llvm_patches/0027-Remove-StringMap-test-for-llvm-sort.patch b/upstream_utils/llvm_patches/0027-Remove-StringMap-test-for-llvm-sort.patch index f238466956..65960f6c30 100644 --- a/upstream_utils/llvm_patches/0027-Remove-StringMap-test-for-llvm-sort.patch +++ b/upstream_utils/llvm_patches/0027-Remove-StringMap-test-for-llvm-sort.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Wed, 10 Aug 2022 22:35:00 -0700 -Subject: [PATCH 27/37] Remove StringMap test for llvm::sort() +Subject: [PATCH 27/38] Remove StringMap test for llvm::sort() --- llvm/unittests/ADT/StringMapTest.cpp | 14 -------------- diff --git a/upstream_utils/llvm_patches/0028-Unused-variable-in-release-mode.patch b/upstream_utils/llvm_patches/0028-Unused-variable-in-release-mode.patch index 3cbe6ff2c5..f684d88f08 100644 --- a/upstream_utils/llvm_patches/0028-Unused-variable-in-release-mode.patch +++ b/upstream_utils/llvm_patches/0028-Unused-variable-in-release-mode.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Mon, 10 Jul 2023 00:53:43 +0200 -Subject: [PATCH 28/37] Unused variable in release mode +Subject: [PATCH 28/38] Unused variable in release mode --- llvm/include/llvm/ADT/DenseMap.h | 2 +- diff --git a/upstream_utils/llvm_patches/0029-Use-C-20-bit-header.patch b/upstream_utils/llvm_patches/0029-Use-C-20-bit-header.patch index 567fa7f7b7..ac42a82f7c 100644 --- a/upstream_utils/llvm_patches/0029-Use-C-20-bit-header.patch +++ b/upstream_utils/llvm_patches/0029-Use-C-20-bit-header.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 11 Jul 2023 22:56:09 -0700 -Subject: [PATCH 29/37] Use C++20 header +Subject: [PATCH 29/38] Use C++20 header --- llvm/include/llvm/ADT/DenseMap.h | 3 +- diff --git a/upstream_utils/llvm_patches/0030-Remove-DenseMap-GTest-printer-test.patch b/upstream_utils/llvm_patches/0030-Remove-DenseMap-GTest-printer-test.patch index 8cf920d275..5b86831fc8 100644 --- a/upstream_utils/llvm_patches/0030-Remove-DenseMap-GTest-printer-test.patch +++ b/upstream_utils/llvm_patches/0030-Remove-DenseMap-GTest-printer-test.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 30 Jul 2023 14:17:37 -0700 -Subject: [PATCH 30/37] Remove DenseMap GTest printer test +Subject: [PATCH 30/38] Remove DenseMap GTest printer test LLVM modifies internal GTest headers to support it, which we can't do. --- diff --git a/upstream_utils/llvm_patches/0031-Replace-deprecated-std-aligned_storage_t.patch b/upstream_utils/llvm_patches/0031-Replace-deprecated-std-aligned_storage_t.patch index e31e52869e..771617ae48 100644 --- a/upstream_utils/llvm_patches/0031-Replace-deprecated-std-aligned_storage_t.patch +++ b/upstream_utils/llvm_patches/0031-Replace-deprecated-std-aligned_storage_t.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 15 Sep 2023 18:26:50 -0700 -Subject: [PATCH 31/37] Replace deprecated std::aligned_storage_t +Subject: [PATCH 31/38] Replace deprecated std::aligned_storage_t --- llvm/include/llvm/ADT/FunctionExtras.h | 4 ++-- diff --git a/upstream_utils/llvm_patches/0032-raw_ostream-Add-SetNumBytesInBuffer.patch b/upstream_utils/llvm_patches/0032-raw_ostream-Add-SetNumBytesInBuffer.patch index f90c64d276..43bca8bbd3 100644 --- a/upstream_utils/llvm_patches/0032-raw_ostream-Add-SetNumBytesInBuffer.patch +++ b/upstream_utils/llvm_patches/0032-raw_ostream-Add-SetNumBytesInBuffer.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 29 Oct 2023 23:00:08 -0700 -Subject: [PATCH 32/37] raw_ostream: Add SetNumBytesInBuffer +Subject: [PATCH 32/38] raw_ostream: Add SetNumBytesInBuffer --- llvm/include/llvm/Support/raw_ostream.h | 5 +++++ diff --git a/upstream_utils/llvm_patches/0033-type_traits.h-Add-is_constexpr.patch b/upstream_utils/llvm_patches/0033-type_traits.h-Add-is_constexpr.patch index 51d178286f..aad2b7f43f 100644 --- a/upstream_utils/llvm_patches/0033-type_traits.h-Add-is_constexpr.patch +++ b/upstream_utils/llvm_patches/0033-type_traits.h-Add-is_constexpr.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 2 Dec 2023 15:21:32 -0800 -Subject: [PATCH 33/37] type_traits.h: Add is_constexpr() +Subject: [PATCH 33/38] type_traits.h: Add is_constexpr() --- llvm/include/llvm/Support/type_traits.h | 5 +++++ diff --git a/upstream_utils/llvm_patches/0034-Add-back-removed-raw_string_ostream-write_impl.patch b/upstream_utils/llvm_patches/0034-Add-back-removed-raw_string_ostream-write_impl.patch index fe5a59cae6..87eb80ad90 100644 --- a/upstream_utils/llvm_patches/0034-Add-back-removed-raw_string_ostream-write_impl.patch +++ b/upstream_utils/llvm_patches/0034-Add-back-removed-raw_string_ostream-write_impl.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 1 Mar 2024 11:37:36 -0800 -Subject: [PATCH 34/37] Add back removed raw_string_ostream::write_impl() +Subject: [PATCH 34/38] Add back removed raw_string_ostream::write_impl() --- llvm/lib/Support/raw_ostream.cpp | 8 ++++++++ diff --git a/upstream_utils/llvm_patches/0035-Remove-auto-conversion-from-raw_ostream.patch b/upstream_utils/llvm_patches/0035-Remove-auto-conversion-from-raw_ostream.patch index 5487edc3ae..6ffcc21eb7 100644 --- a/upstream_utils/llvm_patches/0035-Remove-auto-conversion-from-raw_ostream.patch +++ b/upstream_utils/llvm_patches/0035-Remove-auto-conversion-from-raw_ostream.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 17 Mar 2024 14:51:11 -0700 -Subject: [PATCH 35/37] Remove auto-conversion from raw_ostream +Subject: [PATCH 35/38] Remove auto-conversion from raw_ostream --- llvm/lib/Support/raw_ostream.cpp | 9 --------- diff --git a/upstream_utils/llvm_patches/0036-Add-SmallVector-erase_if.patch b/upstream_utils/llvm_patches/0036-Add-SmallVector-erase_if.patch index 8bff000360..409f76234f 100644 --- a/upstream_utils/llvm_patches/0036-Add-SmallVector-erase_if.patch +++ b/upstream_utils/llvm_patches/0036-Add-SmallVector-erase_if.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 18 Jun 2024 09:07:33 -0700 -Subject: [PATCH 36/37] Add SmallVector erase_if() +Subject: [PATCH 36/38] Add SmallVector erase_if() --- llvm/include/llvm/ADT/SmallVector.h | 8 ++++++++ diff --git a/upstream_utils/llvm_patches/0037-Fix-AlignedCharArrayUnion-for-C-23.patch b/upstream_utils/llvm_patches/0037-Fix-AlignedCharArrayUnion-for-C-23.patch index a0a25ce803..ad7376c521 100644 --- a/upstream_utils/llvm_patches/0037-Fix-AlignedCharArrayUnion-for-C-23.patch +++ b/upstream_utils/llvm_patches/0037-Fix-AlignedCharArrayUnion-for-C-23.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sat, 13 Jul 2024 15:24:30 -0700 -Subject: [PATCH 37/37] Fix AlignedCharArrayUnion for C++23 +Subject: [PATCH 37/38] Fix AlignedCharArrayUnion for C++23 --- llvm/include/llvm/Support/AlignOf.h | 14 +++++--------- diff --git a/upstream_utils/llvm_patches/0038-StringMap-fix-structured-bindings-with-move-only-typ.patch b/upstream_utils/llvm_patches/0038-StringMap-fix-structured-bindings-with-move-only-typ.patch new file mode 100644 index 0000000000..d7f4a78202 --- /dev/null +++ b/upstream_utils/llvm_patches/0038-StringMap-fix-structured-bindings-with-move-only-typ.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ryan Blue +Date: Tue, 24 Sep 2024 23:36:16 -0400 +Subject: [PATCH 38/38] StringMap: fix structured bindings with move-only types + +--- + llvm/include/llvm/ADT/StringMapEntry.h | 12 +++++++++++- + llvm/unittests/ADT/StringMapTest.cpp | 10 ++++++++++ + 2 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/llvm/include/llvm/ADT/StringMapEntry.h b/llvm/include/llvm/ADT/StringMapEntry.h +index 011806f5fd89ff738ed805a82b3ddbc6fc9b08ce..5b8eeb167c53c7ab15d05b0c71b75cd7f5b496c5 100644 +--- a/llvm/include/llvm/ADT/StringMapEntry.h ++++ b/llvm/include/llvm/ADT/StringMapEntry.h +@@ -159,7 +159,17 @@ decltype(auto) get(const StringMapEntry &E) { + if constexpr (Index == 0) + return E.first(); + else +- return E.second; ++ return (E.second); ++} ++ ++// Allow structured bindings on StringMapEntry. ++template ++decltype(auto) get(StringMapEntry &E) { ++ static_assert(Index < 2); ++ if constexpr (Index == 0) ++ return E.first(); ++ else ++ return (E.second); + } + + } // end namespace llvm +diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp +index 0d83669a580408e925ec6308410ebe7c01b48b12..f1834bec65afec6be4365e52c4e21aa61cbb1d12 100644 +--- a/llvm/unittests/ADT/StringMapTest.cpp ++++ b/llvm/unittests/ADT/StringMapTest.cpp +@@ -526,6 +526,16 @@ TEST_F(StringMapTest, StructuredBindings) { + } + } + ++TEST_F(StringMapTest, StructuredBindingsMoveOnly) { ++ StringMap A; ++ A.insert(std::make_pair("a", MoveOnly(42))); ++ ++ for (auto &&[Key, Value] : A) { ++ EXPECT_EQ("a", Key); ++ EXPECT_EQ(42, Value.i); ++ } ++} ++ + namespace { + // Simple class that counts how many moves and copy happens when growing a map + struct CountCtorCopyAndMove { diff --git a/wpiutil/src/main/native/thirdparty/llvm/include/wpi/StringMapEntry.h b/wpiutil/src/main/native/thirdparty/llvm/include/wpi/StringMapEntry.h index 88de972219..968989bc03 100644 --- a/wpiutil/src/main/native/thirdparty/llvm/include/wpi/StringMapEntry.h +++ b/wpiutil/src/main/native/thirdparty/llvm/include/wpi/StringMapEntry.h @@ -159,7 +159,17 @@ decltype(auto) get(const StringMapEntry &E) { if constexpr (Index == 0) return E.first(); else - return E.second; + return (E.second); +} + +// Allow structured bindings on StringMapEntry. +template +decltype(auto) get(StringMapEntry &E) { + static_assert(Index < 2); + if constexpr (Index == 0) + return E.first(); + else + return (E.second); } } // end namespace wpi diff --git a/wpiutil/src/test/native/cpp/llvm/StringMapTest.cpp b/wpiutil/src/test/native/cpp/llvm/StringMapTest.cpp index 760749846c..70896dac2b 100644 --- a/wpiutil/src/test/native/cpp/llvm/StringMapTest.cpp +++ b/wpiutil/src/test/native/cpp/llvm/StringMapTest.cpp @@ -525,6 +525,16 @@ TEST_F(StringMapTest, StructuredBindings) { } } +TEST_F(StringMapTest, StructuredBindingsMoveOnly) { + StringMap A; + A.insert(std::make_pair("a", MoveOnly(42))); + + for (auto &&[Key, Value] : A) { + EXPECT_EQ("a", Key); + EXPECT_EQ(42, Value.i); + } +} + namespace { // Simple class that counts how many moves and copy happens when growing a map struct CountCtorCopyAndMove {