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 | 8774fe816a2132e3c3f82a94461d02b13f8a57c6 (patch) | |
| tree | d8f8293b46cbd6a300e0fbfbf1c96bd302f9b745 /llvm/lib/VMCore | |
| parent | 56f784d12d00a0a9d93c9ef860141e0595d31828 (diff) | |
| download | bcm5719-llvm-8774fe816a2132e3c3f82a94461d02b13f8a57c6.tar.gz bcm5719-llvm-8774fe816a2132e3c3f82a94461d02b13f8a57c6.zip  | |
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.
llvm-svn: 34757
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 4 | 
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 37e0abec988..29f096364f4 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/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  //===----------------------------------------------------------------------===//  | 

