[llvm] r307297 - [llvm] Separate out reverse iteration flag into its own header

Mandeep Singh Grang via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 11:52:16 PDT 2017


Author: mgrang
Date: Thu Jul  6 11:52:16 2017
New Revision: 307297

URL: http://llvm.org/viewvc/llvm-project?rev=307297&view=rev
Log:
[llvm] Separate out reverse iteration flag into its own header

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

Added:
    llvm/trunk/include/llvm/Support/ReverseIteration.h
Modified:
    llvm/trunk/include/llvm/ADT/SmallPtrSet.h

Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=307297&r1=307296&r2=307297&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Thu Jul  6 11:52:16 2017
@@ -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.

Added: llvm/trunk/include/llvm/Support/ReverseIteration.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ReverseIteration.h?rev=307297&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/ReverseIteration.h (added)
+++ llvm/trunk/include/llvm/Support/ReverseIteration.h Thu Jul  6 11:52:16 2017
@@ -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




More information about the llvm-commits mailing list