[clang] afc14a0 - Retire llvm::make_reverse_iterator in favor of std::make_reverse_iterator
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 5 05:08:09 PST 2022
Author: Benjamin Kramer
Date: 2022-01-05T14:07:08+01:00
New Revision: afc14a0d1767d9f9dc1b9d81a2f76916ba2bab61
URL: https://github.com/llvm/llvm-project/commit/afc14a0d1767d9f9dc1b9d81a2f76916ba2bab61
DIFF: https://github.com/llvm/llvm-project/commit/afc14a0d1767d9f9dc1b9d81a2f76916ba2bab61.diff
LOG: Retire llvm::make_reverse_iterator in favor of std::make_reverse_iterator
std::make_reverse_iterator is a C++14 feature, gcc has it since GCC 5.1.
Added:
Modified:
clang/include/clang/Analysis/CFG.h
clang/tools/clang-scan-deps/ClangScanDeps.cpp
lld/ELF/Writer.cpp
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
Removed:
################################################################################
diff --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h
index b8e453fcc235a..c5512a7e14998 100644
--- a/clang/include/clang/Analysis/CFG.h
+++ b/clang/include/clang/Analysis/CFG.h
@@ -707,7 +707,7 @@ class CFGBlock {
template <bool IsOtherConst>
ElementRefIterator(ElementRefIterator<true, IsOtherConst> E)
- : ElementRefIterator(E.Parent, llvm::make_reverse_iterator(E.Pos)) {}
+ : ElementRefIterator(E.Parent, std::make_reverse_iterator(E.Pos)) {}
bool operator<(ElementRefIterator Other) const {
assert(Parent == Other.Parent);
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 4d61e37db29bd..49cc97b27046f 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -480,7 +480,7 @@ int main(int argc, const char **argv) {
llvm::is_contained(Args, "--driver-mode=cl");
// Reverse scan, starting at the end or at the element before "--".
- auto R = llvm::make_reverse_iterator(FlagsEnd);
+ auto R = std::make_reverse_iterator(FlagsEnd);
for (auto I = R, E = Args.rend(); I != E; ++I) {
StringRef Arg = *I;
if (ClangCLMode) {
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 6527493f1b1fd..9db997cddfbe3 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1212,9 +1212,9 @@ findOrphanPos(SmallVectorImpl<SectionCommand *>::iterator b,
auto *os = dyn_cast<OutputSection>(cmd);
return os && os->hasInputSections;
};
- auto j = std::find_if(llvm::make_reverse_iterator(i),
- llvm::make_reverse_iterator(b),
- isOutputSecWithInputSections);
+ auto j =
+ std::find_if(std::make_reverse_iterator(i), std::make_reverse_iterator(b),
+ isOutputSecWithInputSections);
i = j.base();
// As a special case, if the orphan section is the last section, put
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 2d38e153c79e0..ed5321821a3a2 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -416,20 +416,14 @@ auto reverse(ContainerTy &&C,
return make_range(C.rbegin(), C.rend());
}
-// Returns a std::reverse_iterator wrapped around the given iterator.
-template <typename IteratorTy>
-std::reverse_iterator<IteratorTy> make_reverse_iterator(IteratorTy It) {
- return std::reverse_iterator<IteratorTy>(It);
-}
-
// Returns an iterator_range over the given container which iterates in reverse.
// Note that the container must have begin()/end() methods which return
// bidirectional iterators for this to work.
template <typename ContainerTy>
auto reverse(ContainerTy &&C,
std::enable_if_t<!has_rbegin<ContainerTy>::value> * = nullptr) {
- return make_range(llvm::make_reverse_iterator(std::end(C)),
- llvm::make_reverse_iterator(std::begin(C)));
+ return make_range(std::make_reverse_iterator(std::end(C)),
+ std::make_reverse_iterator(std::begin(C)));
}
/// An iterator adaptor that filters the elements of given inner iterators.
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
index 8f93ebc4ebc0b..0d4fe9aec8d03 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -463,11 +463,11 @@ inline bool operator!=(const std::reverse_iterator<DWARFDie::iterator> &LHS,
}
inline std::reverse_iterator<DWARFDie::iterator> DWARFDie::rbegin() const {
- return llvm::make_reverse_iterator(end());
+ return std::make_reverse_iterator(end());
}
inline std::reverse_iterator<DWARFDie::iterator> DWARFDie::rend() const {
- return llvm::make_reverse_iterator(begin());
+ return std::make_reverse_iterator(begin());
}
} // end namespace llvm
More information about the cfe-commits
mailing list