aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 527eff5490..05bbef16b3 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -278,7 +278,7 @@ ConstantStruct::ConstantStruct(const StructType *T,
}
ConstantPointerRef::ConstantPointerRef(GlobalValue *GV)
- : ConstantPointer(GV->getType()) {
+ : Constant(GV->getType()) {
Operands.push_back(Use(GV, this));
}
@@ -337,8 +337,15 @@ bool ConstantArray::classof(const Constant *CPV) {
bool ConstantStruct::classof(const Constant *CPV) {
return isa<StructType>(CPV->getType()) && !isa<ConstantExpr>(CPV);
}
-bool ConstantPointer::classof(const Constant *CPV) {
- return (isa<PointerType>(CPV->getType()) && !isa<ConstantExpr>(CPV));
+
+bool ConstantPointerNull::classof(const Constant *CPV) {
+ return isa<PointerType>(CPV->getType()) && !isa<ConstantExpr>(CPV) &&
+ CPV->getNumOperands() == 0;
+}
+
+bool ConstantPointerRef::classof(const Constant *CPV) {
+ return isa<PointerType>(CPV->getType()) && !isa<ConstantExpr>(CPV) &&
+ CPV->getNumOperands() == 1;
}