[llvm] db008af - [llvm] Repair the modules build with C++17

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 15:04:51 PDT 2022


Author: Jonas Devlieghere
Date: 2022-08-08T15:04:46-07:00
New Revision: db008af501534d4590542253ae3acf783986f5f7

URL: https://github.com/llvm/llvm-project/commit/db008af501534d4590542253ae3acf783986f5f7
DIFF: https://github.com/llvm/llvm-project/commit/db008af501534d4590542253ae3acf783986f5f7.diff

LOG: [llvm] Repair the modules build with C++17

I'm honestly not sure if this is a legitimate issue or not, but after
switching from C++14 to C++17, the modules build started confusing
arrays and initializer lists. Work around the issue by being explicit.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLExtras.h
    llvm/include/llvm/Support/FormatProviders.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 8e18b6a95aac0..c56ca97856c2b 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -725,8 +725,8 @@ class zip_shortest : public zip_common<zip_shortest<Iters...>, Iters...> {
   template <size_t... Ns>
   bool test(const zip_shortest<Iters...> &other,
             std::index_sequence<Ns...>) const {
-    return all_of(std::initializer_list<bool>{std::get<Ns>(this->iterators) !=
-                                              std::get<Ns>(other.iterators)...},
+    return all_of(std::array{std::get<Ns>(this->iterators) !=
+                             std::get<Ns>(other.iterators)...},
                   identity<bool>{});
   }
 

diff  --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h
index 8101ed7968adb..7cfce29b134fc 100644
--- a/llvm/include/llvm/Support/FormatProviders.h
+++ b/llvm/include/llvm/Support/FormatProviders.h
@@ -21,8 +21,8 @@
 #include "llvm/Support/FormatVariadicDetails.h"
 #include "llvm/Support/NativeFormatting.h"
 
+#include <array>
 #include <type_traits>
-#include <vector>
 
 namespace llvm {
 namespace detail {
@@ -369,7 +369,7 @@ template <typename IterT> class format_provider<llvm::iterator_range<IterT>> {
       return Default;
     }
 
-    for (const char *D : {"[]", "<>", "()"}) {
+    for (const char *D : std::array{"[]", "<>", "()"}) {
       if (Style.front() != D[0])
         continue;
       size_t End = Style.find_first_of(D[1]);


        


More information about the llvm-commits mailing list