[ADT] Fix circular include dependency by using std::array. NFC
authorYounan Zhang <zyn7109@gmail.com>
Tue, 24 Jan 2023 23:58:34 +0000 (15:58 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 25 Jan 2023 00:09:48 +0000 (16:09 -0800)
2db6b34ea 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?

Differential revision: https://reviews.llvm.org/D141352

llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/MC/SubtargetFeature.h

index be8800c..f6a1bd8 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef LLVM_ADT_STLEXTRAS_H
 #define LLVM_ADT_STLEXTRAS_H
 
-#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/identity.h"
@@ -26,6 +26,7 @@
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
+#include <array>
 #include <cassert>
 #include <cstddef>
 #include <cstdint>
@@ -832,9 +833,10 @@ 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(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:
index 98aed32..c38b532 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef LLVM_MC_SUBTARGETFEATURE_H
 #define LLVM_MC_SUBTARGETFEATURE_H
 
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/MathExtras.h"