[llvm] 20556c4 - [ADT] Fix circular include dependency by using std::array. NFC
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 24 16:09:56 PST 2023
Author: Younan Zhang
Date: 2023-01-24T16:09:48-08:00
New Revision: 20556c483411f0f606f2529a1ef72a0c00ef7e75
URL: https://github.com/llvm/llvm-project/commit/20556c483411f0f606f2529a1ef72a0c00ef7e75
DIFF: https://github.com/llvm/llvm-project/commit/20556c483411f0f606f2529a1ef72a0c00ef7e75.diff
LOG: [ADT] Fix circular include dependency by using std::array. NFC
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
Added:
Modified:
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/MC/SubtargetFeature.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index be8800cc46450..f6a1bd89bbe8c 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -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:
diff --git a/llvm/include/llvm/MC/SubtargetFeature.h b/llvm/include/llvm/MC/SubtargetFeature.h
index 98aed32a55d6e..c38b532f21e57 100644
--- a/llvm/include/llvm/MC/SubtargetFeature.h
+++ b/llvm/include/llvm/MC/SubtargetFeature.h
@@ -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"
More information about the llvm-commits
mailing list