diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-28 19:50:21 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-28 19:50:21 +0000 |
commit | f57fc81faebf3eb81fb30fe17c4295d46060e03f (patch) | |
tree | 26506571b863ad9dbf43377ac1d6ec234704c169 /lib/VMCore/Constants.cpp | |
parent | dc5c1597014fa5c47c94db2b9fd424d2266053db (diff) |
Implement a convenience method to construct a ConstantInt directly from an
APInt. The implied type is the integer type that corresponds to the bit
width of the APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r-- | lib/VMCore/Constants.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 37e0abec98..29f096364f 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -216,6 +216,10 @@ ConstantInt *ConstantInt::get(const Type *Ty, const APInt& V) { return Slot = new ConstantInt(ITy, V); } +ConstantInt *ConstantInt::get(const APInt &V) { + return ConstantInt::get(IntegerType::get(V.getBitWidth()), V); +} + //===----------------------------------------------------------------------===// // ConstantFP //===----------------------------------------------------------------------===// |