Remove useless variable.

This commit is contained in:
Lei Zhang 2015-09-14 15:26:12 -04:00 committed by David Neto
parent c0b32ecb54
commit 97afd5c03c

View File

@ -216,7 +216,6 @@ spv_result_t spvBinaryDecodeOperand(
bool color = bool color =
print && spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_COLOR, options); print && spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_COLOR, options);
uint64_t index = 0;
switch (type) { switch (type) {
case SPV_OPERAND_TYPE_ID: case SPV_OPERAND_TYPE_ID:
case SPV_OPERAND_TYPE_RESULT_ID: case SPV_OPERAND_TYPE_RESULT_ID:
@ -229,9 +228,8 @@ spv_result_t spvBinaryDecodeOperand(
stream.get() << clr::yellow(); stream.get() << clr::yellow();
} }
} }
stream.get() << "%" << spvFixWord(words[index], endian); stream.get() << "%" << spvFixWord(words[0], endian);
stream.get() << ((color) ? clr::reset() : ""); stream.get() << ((color) ? clr::reset() : "");
index++;
position->index++; position->index++;
} break; } break;
case SPV_OPERAND_TYPE_LITERAL_NUMBER: { case SPV_OPERAND_TYPE_LITERAL_NUMBER: {
@ -247,7 +245,6 @@ spv_result_t spvBinaryDecodeOperand(
stream.get() << (color ? clr::red() : ""); stream.get() << (color ? clr::red() : "");
stream.get() << extInst->name; stream.get() << extInst->name;
stream.get() << (color ? clr::reset() : ""); stream.get() << (color ? clr::reset() : "");
index++;
position->index++; position->index++;
break; break;
} }
@ -257,14 +254,13 @@ spv_result_t spvBinaryDecodeOperand(
case SPV_OPERAND_TYPE_LITERAL_IN_OPTIONAL_TUPLE: { case SPV_OPERAND_TYPE_LITERAL_IN_OPTIONAL_TUPLE: {
// TODO: Need to support multiple word literals // TODO: Need to support multiple word literals
stream.get() << (color ? clr::red() : ""); stream.get() << (color ? clr::red() : "");
stream.get() << spvFixWord(words[index], endian); stream.get() << spvFixWord(words[0], endian);
stream.get() << (color ? clr::reset() : ""); stream.get() << (color ? clr::reset() : "");
index++;
position->index++; position->index++;
} break; } break;
case SPV_OPERAND_TYPE_LITERAL_STRING: case SPV_OPERAND_TYPE_LITERAL_STRING:
case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: {
const char *string = (const char *)&words[index]; const char *string = (const char *)words;
uint64_t stringOperandCount = (strlen(string) / 4) + 1; uint64_t stringOperandCount = (strlen(string) / 4) + 1;
// NOTE: Special case for extended instruction import // NOTE: Special case for extended instruction import
@ -282,7 +278,6 @@ spv_result_t spvBinaryDecodeOperand(
stream.get() << string; stream.get() << string;
stream.get() << (color ? clr::reset() : ""); stream.get() << (color ? clr::reset() : "");
stream.get() << "\""; stream.get() << "\"";
index += stringOperandCount;
position->index += stringOperandCount; position->index += stringOperandCount;
} break; } break;
case SPV_OPERAND_TYPE_CAPABILITY: case SPV_OPERAND_TYPE_CAPABILITY:
@ -313,16 +308,15 @@ spv_result_t spvBinaryDecodeOperand(
case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS:
case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: { case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: {
spv_operand_desc entry; spv_operand_desc entry;
if (spvOperandTableValueLookup( if (spvOperandTableValueLookup(operandTable, type,
operandTable, type, spvFixWord(words[index], endian), &entry)) { spvFixWord(words[0], endian), &entry)) {
DIAGNOSTIC << "Invalid " << spvOperandTypeStr(type) << " operand '" DIAGNOSTIC << "Invalid " << spvOperandTypeStr(type) << " operand '"
<< words[index] << "'."; << words[0] << "'.";
return SPV_ERROR_INVALID_TEXT; return SPV_ERROR_INVALID_TEXT;
} }
stream.get() << entry->name; stream.get() << entry->name;
// Prepare to accept operands to this operand, if needed. // Prepare to accept operands to this operand, if needed.
spvPrependOperandTypes(entry->operandTypes, pExpectedOperands); spvPrependOperandTypes(entry->operandTypes, pExpectedOperands);
index++;
position->index++; position->index++;
} break; } break;
default: { default: {