aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 0525882828..9f1abbd17b 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -1994,6 +1994,11 @@ Type *ConstantDataSequential::getElementType() const {
return getType()->getElementType();
}
+StringRef ConstantDataSequential::getRawDataValues() const {
+ return StringRef(DataElements,
+ getType()->getNumElements()*getElementByteSize());
+}
+
/// isElementTypeCompatible - Return true if a ConstantDataSequential can be
/// formed with a vector or array of the specified element type.
/// ConstantDataArray only works with normal float and int types that are
@@ -2067,14 +2072,12 @@ Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) {
}
void ConstantDataSequential::destroyConstant() {
- uint64_t ByteSize = getElementByteSize() * getElementType()->getNumElements();
-
// Remove the constant from the StringMap.
StringMap<ConstantDataSequential*> &CDSConstants =
getType()->getContext().pImpl->CDSConstants;
StringMap<ConstantDataSequential*>::iterator Slot =
- CDSConstants.find(StringRef(DataElements, ByteSize));
+ CDSConstants.find(getRawDataValues());
assert(Slot != CDSConstants.end() && "CDS not found in uniquing table");
@@ -2226,15 +2229,6 @@ bool ConstantDataSequential::isString() const {
return isa<ArrayType>(getType()) && getElementType()->isIntegerTy(8);
}
-/// getAsString - If this array is isString(), then this method returns the
-/// array as a StringRef. Otherwise, it asserts out.
-///
-StringRef ConstantDataSequential::getAsString() const {
- assert(isString() && "Not a string");
- return StringRef(DataElements, getType()->getNumElements());
-}
-
-
/// isCString - This method returns true if the array "isString", ends with a
/// nul byte, and does not contains any other nul bytes.
bool ConstantDataSequential::isCString() const {