From: David Neto Date: Tue, 5 Jan 2016 19:56:02 +0000 (-0500) Subject: Avoid variable shadowing X-Git-Tag: upstream/2018.6~1389 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=677e0c7b499d74a90470133924ec25310e45dc8a;p=platform%2Fupstream%2FSPIRV-Tools.git Avoid variable shadowing --- diff --git a/source/binary.cpp b/source/binary.cpp index 99cf30f..7a3ec35 100755 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -463,18 +463,20 @@ spv_result_t Parser::parseOperand(size_t inst_offset, switch (type) { case SPV_OPERAND_TYPE_TYPE_ID: - if (!word) return diagnostic(SPV_ERROR_INVALID_ID) << "Error: Type Id is 0"; + if (!word) + return diagnostic(SPV_ERROR_INVALID_ID) << "Error: Type Id is 0"; inst->type_id = word; break; case SPV_OPERAND_TYPE_RESULT_ID: - if (!word) return diagnostic(SPV_ERROR_INVALID_ID) << "Error: Result Id is 0"; + if (!word) + return diagnostic(SPV_ERROR_INVALID_ID) << "Error: Result Id is 0"; inst->result_id = word; // Save the result ID to type ID mapping. // In the grammar, type ID always appears before result ID. if (_.id_to_type_id.find(inst->result_id) != _.id_to_type_id.end()) return diagnostic(SPV_ERROR_INVALID_ID) << "Id " << inst->result_id - << " is defined more than once"; + << " is defined more than once"; // Record it. // A regular value maps to its type. Some instructions (e.g. OpLabel) // have no type Id, and will map to 0. The result Id for a @@ -736,8 +738,8 @@ spv_result_t Parser::parseOperand(size_t inst_offset, if (convert_operand_endianness) { const spv_endianness_t endianness = _.endian; std::transform(_.words + _.word_index, _.words + index_after_operand, - words->end(), [endianness](const uint32_t word) { - return spvFixWord(word, endianness); + words->end(), [endianness](const uint32_t raw_word) { + return spvFixWord(raw_word, endianness); }); } else { words->insert(words->end(), _.words + _.word_index, diff --git a/source/text.cpp b/source/text.cpp index c86ff6e..3386f18 100755 --- a/source/text.cpp +++ b/source/text.cpp @@ -368,8 +368,8 @@ spv_result_t spvTextEncodeOperand(const libspirv::AssemblyGrammar& grammar, << "Invalid extended instruction import '" << literal.str << "'"; } - if (auto error = context->recordIdAsExtInstImport(pInst->words[1], - ext_inst_type)) + if ((error = context->recordIdAsExtInstImport(pInst->words[1], + ext_inst_type))) return error; } diff --git a/source/validate.cpp b/source/validate.cpp index 80bb4c4..eb4ecc6 100644 --- a/source/validate.cpp +++ b/source/validate.cpp @@ -552,11 +552,10 @@ spv_result_t ProcessInstructions(void* user_data, // TODO(umar): Perform CFG pass // TODO(umar): Perform data rules pass // TODO(umar): Perform instruction validation pass - spv_result_t ret = SPV_SUCCESS; CHECK_RESULT(ModuleLayoutPass(_, inst)) CHECK_RESULT(SsaPass(_, can_have_forward_declared_ids, inst)) - return ret; + return SPV_SUCCESS; } } // anonymous namespace diff --git a/source/validate_id.cpp b/source/validate_id.cpp index cdb8e59..4901e79 100644 --- a/source/validate_id.cpp +++ b/source/validate_id.cpp @@ -44,20 +44,20 @@ namespace { class idUsage { public: - idUsage(const spv_opcode_table opcodeTable, - const spv_operand_table operandTable, - const spv_ext_inst_table extInstTable, const spv_id_info_t* pIdUses, + idUsage(const spv_opcode_table opcodeTableArg, + const spv_operand_table operandTableArg, + const spv_ext_inst_table extInstTableArg, const spv_id_info_t* pIdUses, const uint64_t idUsesCount, const spv_id_info_t* pIdDefs, const uint64_t idDefsCount, const spv_instruction_t* pInsts, - const uint64_t instCount, spv_position position, - spv_diagnostic* pDiagnostic) - : opcodeTable(opcodeTable), - operandTable(operandTable), - extInstTable(extInstTable), + const uint64_t instCountArg, spv_position positionArg, + spv_diagnostic* pDiagnosticArg) + : opcodeTable(opcodeTableArg), + operandTable(operandTableArg), + extInstTable(extInstTableArg), firstInst(pInsts), - instCount(instCount), - position(position), - pDiagnostic(pDiagnostic) { + instCount(instCountArg), + position(positionArg), + pDiagnostic(pDiagnosticArg) { for (uint64_t idUsesIndex = 0; idUsesIndex < idUsesCount; ++idUsesIndex) { idUses[pIdUses[idUsesIndex].id].push_back(pIdUses[idUsesIndex]); }