]> granicus.if.org Git - llvm/commitdiff
[llvm] Separate out reverse iteration flag into its own header
authorMandeep Singh Grang <mgrang@codeaurora.org>
Thu, 6 Jul 2017 18:52:16 +0000 (18:52 +0000)
committerMandeep Singh Grang <mgrang@codeaurora.org>
Thu, 6 Jul 2017 18:52:16 +0000 (18:52 +0000)
Summary: This will ease out adding reverse iteration flags to other containers by simply including the header.

Reviewers: mehdi_amini, dexonsmith, davide, dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35042

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307297 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallPtrSet.h
include/llvm/Support/ReverseIteration.h [new file with mode: 0644]

index a2ad74b1e04aeb56bf2734e64eb180e715ce1f5f..4e8a2490ee3c5a8747578ee08d27c156986927c0 100644 (file)
@@ -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>
 
 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.
diff --git a/include/llvm/Support/ReverseIteration.h b/include/llvm/Support/ReverseIteration.h
new file mode 100644 (file)
index 0000000..cb97b60
--- /dev/null
@@ -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