diff options
author | Chris Lattner <sabre@nondot.org> | 2004-06-21 12:12:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-06-21 12:12:12 +0000 |
commit | c2dfb8bb909b0ba08733be94821513aef9467fa0 (patch) | |
tree | 6a24c80fe25469cf253dd42d0c973a73655f28ee /lib | |
parent | 1a580bea99e109895f24369399c563877b3fad19 (diff) | |
download | external_llvm-c2dfb8bb909b0ba08733be94821513aef9467fa0.zip external_llvm-c2dfb8bb909b0ba08733be94821513aef9467fa0.tar.gz external_llvm-c2dfb8bb909b0ba08733be94821513aef9467fa0.tar.bz2 |
Make ConstantBool act like a 1 bit ConstantInt, in order to simplify client
code. Patch contributed by Vladimir Prus.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14280 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Constants.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index e18f9b2..9957327 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -212,12 +212,15 @@ bool ConstantUInt::isAllOnesValue() const { //===----------------------------------------------------------------------===// // Normal Constructors -ConstantBool::ConstantBool(bool V) : ConstantIntegral(Type::BoolTy) { - Val = V; +ConstantIntegral::ConstantIntegral(const Type *Ty, uint64_t V) + : Constant(Ty) { + Val.Unsigned = V; +} + +ConstantBool::ConstantBool(bool V) : ConstantIntegral(Type::BoolTy, V) { } -ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : ConstantIntegral(Ty) { - Val.Unsigned = V; +ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : ConstantIntegral(Ty, V) { } ConstantSInt::ConstantSInt(const Type *Ty, int64_t V) : ConstantInt(Ty, V) { |