[PATCH] D141352: [ADT] Fix circular include dependency by using std::array. NFC

Younan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 21:31:43 PST 2023


zyounan created this revision.
zyounan added a reviewer: JDevlieghere.
Herald added a project: All.
zyounan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

2db6b34ea <https://reviews.llvm.org/rG2db6b34ea8136b02ef533268f0324541c7f93d95> introduces circular dependency on `llvm::ArrayRef`. By inspecting commit history,
it appears that we have some issue using deduction guide on `std::array`.
Why don't we try `std::array` with explicit template arguments?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141352

Files:
  llvm/include/llvm/ADT/STLExtras.h


Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -17,7 +17,6 @@
 #ifndef LLVM_ADT_STLEXTRAS_H
 #define LLVM_ADT_STLEXTRAS_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/identity.h"
@@ -26,6 +25,7 @@
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
+#include <array>
 #include <cassert>
 #include <cstddef>
 #include <cstdint>
@@ -826,9 +826,10 @@
   template <size_t... Ns>
   bool test(const zip_shortest<Iters...> &other,
             std::index_sequence<Ns...>) const {
-    return all_of(llvm::ArrayRef<bool>({std::get<Ns>(this->iterators) !=
-                                        std::get<Ns>(other.iterators)...}),
-                  identity<bool>{});
+    return all_of(
+        std::array<bool, sizeof...(Ns)>({std::get<Ns>(this->iterators) !=
+                                         std::get<Ns>(other.iterators)...}),
+        identity<bool>{});
   }
 
 public:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141352.487667.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230110/d5f10e54/attachment.bin>


More information about the llvm-commits mailing list