summaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index faef147..856cd1a 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -93,11 +93,12 @@ void Constant::destroyConstantImpl() {
//===----------------------------------------------------------------------===//
// Normal Constructors
-ConstantBool::ConstantBool(bool V) : Constant(Type::BoolTy) {
+ConstantBool::ConstantBool(bool V) : ConstantGenericIntegral(Type::BoolTy) {
Val = V;
}
-ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : Constant(Ty) {
+ConstantInt::ConstantInt(const Type *Ty, uint64_t V)
+ : ConstantGenericIntegral(Ty) {
Val.Unsigned = V;
}
@@ -163,6 +164,11 @@ ConstantExpr::ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
//===----------------------------------------------------------------------===//
// classof implementations
+bool ConstantGenericIntegral::classof(const Constant *CPV) {
+ return (CPV->getType()->isIntegral() || CPV->getType() == Type::BoolTy) &&
+ !isa<ConstantExpr>(CPV);
+}
+
bool ConstantInt::classof(const Constant *CPV) {
return CPV->getType()->isIntegral() && !isa<ConstantExpr>(CPV);
}