Add a convenience constructor.

llvm-svn: 110493
This commit is contained in:
Owen Anderson 2010-08-07 00:42:06 +00:00
parent 71b30e0db6
commit 07d0637000
2 changed files with 6 additions and 0 deletions

View 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

View 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) {