Add a convenience constructor.
authorOwen Anderson <resistor@mac.com>
Sat, 7 Aug 2010 00:42:06 +0000 (00:42 +0000)
committerOwen Anderson <resistor@mac.com>
Sat, 7 Aug 2010 00:42:06 +0000 (00:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110493 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/ConstantRange.h
lib/Support/ConstantRange.cpp

index 607a94fb4b5966a86f5663e4ec570d797204d7f6..1187cfd94949b3434f07f5d9935b2b7b43e9e0fd 100644 (file)
@@ -37,6 +37,8 @@
 
 namespace llvm {
 
+class ConstantInt;
+
 /// ConstantRange - This class represents an range of values.
 ///
 class ConstantRange {
@@ -52,6 +54,7 @@ public:
   /// Initialize a range to hold the single specified value.
   ///
   ConstantRange(const APInt &Value);
+  ConstantRange(const ConstantInt *Value);
 
   /// @brief Initialize a range of values explicitly. This will assert out if
   /// Lower==Upper and Lower != Min or Max value for its type. It will also
index 2746f7aaaa5e81328e1edc279b8e686b8b45e9c2..fb0442823c4c5b6f3d0f6e223eed721d811c4602 100644 (file)
@@ -21,6 +21,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Constants.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -39,6 +40,8 @@ ConstantRange::ConstantRange(uint32_t BitWidth, bool Full) {
 /// Initialize a range to hold the single specified value.
 ///
 ConstantRange::ConstantRange(const APInt & V) : Lower(V), Upper(V + 1) {}
+ConstantRange::ConstantRange(const ConstantInt *V)
+  : Lower(V->getValue()), Upper(V->getValue() + 1) {}
 
 ConstantRange::ConstantRange(const APInt &L, const APInt &U) :
   Lower(L), Upper(U) {