[PATCH] D35042: [llvm] Separate out reverse iteration flag into its own header

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 22:29:50 PDT 2017


mgrang created this revision.

This will ease out adding reverse iteration flags to other containers by simply including the header.


Repository:
  rL LLVM

https://reviews.llvm.org/D35042

Files:
  include/llvm/ADT/SmallPtrSet.h
  include/llvm/Support/ReverseIteration.h


Index: include/llvm/Support/ReverseIteration.h
===================================================================
--- /dev/null
+++ include/llvm/Support/ReverseIteration.h
@@ -0,0 +1,17 @@
+#ifndef LLVM_SUPPORT_REVERSEITERATION_H
+#define LLVM_SUPPORT_REVERSEITERATION_H
+
+#include "llvm/Config/abi-breaking.h"
+
+namespace llvm {
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
+template <class T = void> struct ReverseIterate { static bool value; };
+#if LLVM_ENABLE_REVERSE_ITERATION
+template <class T> bool ReverseIterate<T>::value = true;
+#else
+template <class T> bool ReverseIterate<T>::value = false;
+#endif
+#endif
+}
+
+#endif
Index: include/llvm/ADT/SmallPtrSet.h
===================================================================
--- include/llvm/ADT/SmallPtrSet.h
+++ include/llvm/ADT/SmallPtrSet.h
@@ -15,9 +15,9 @@
 #ifndef LLVM_ADT_SMALLPTRSET_H
 #define LLVM_ADT_SMALLPTRSET_H
 
-#include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/PointerLikeTypeTraits.h"
+#include "llvm/Support/ReverseIteration.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <cstddef>
@@ -29,15 +29,6 @@
 
 namespace llvm {
 
-#if LLVM_ENABLE_ABI_BREAKING_CHECKS
-template <class T = void> struct ReverseIterate { static bool value; };
-#if LLVM_ENABLE_REVERSE_ITERATION
-template <class T> bool ReverseIterate<T>::value = true;
-#else
-template <class T> bool ReverseIterate<T>::value = false;
-#endif
-#endif
-
 /// SmallPtrSetImplBase - This is the common code shared among all the
 /// SmallPtrSet<>'s, which is almost everything.  SmallPtrSet has two modes, one
 /// for small and one for large sets.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35042.105372.patch
Type: text/x-patch
Size: 1659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/b7e3189d/attachment.bin>


More information about the llvm-commits mailing list