mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
As Chris pointed out, this doesn't actually need an LLVMContext to operate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75508 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1416,19 +1416,19 @@ bool ConstantArray::isString() const {
|
||||
/// isCString - This method returns true if the array is a string (see
|
||||
/// isString) and it ends in a null byte \\0 and does not contains any other
|
||||
/// null bytes except its terminator.
|
||||
bool ConstantArray::isCString(LLVMContext &Context) const {
|
||||
bool ConstantArray::isCString() const {
|
||||
// Check the element type for i8...
|
||||
if (getType()->getElementType() != Type::Int8Ty)
|
||||
return false;
|
||||
Constant *Zero = Context.getNullValue(getOperand(0)->getType());
|
||||
|
||||
// Last element must be a null.
|
||||
if (getOperand(getNumOperands()-1) != Zero)
|
||||
if (!getOperand(getNumOperands()-1)->isNullValue())
|
||||
return false;
|
||||
// Other elements must be non-null integers.
|
||||
for (unsigned i = 0, e = getNumOperands()-1; i != e; ++i) {
|
||||
if (!isa<ConstantInt>(getOperand(i)))
|
||||
return false;
|
||||
if (getOperand(i) == Zero)
|
||||
if (getOperand(i)->isNullValue())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user