mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-21 19:20:07 +00:00
[NFC] Apply small clang-tidy fixes (#5709)
* [NFC] Apply small clang-tidy fixes - const for passed-by-value has no effect on prototypes. - transitive includes. - dead stores - uses after move Signed-off-by: Nathan Gauër <brioche@google.com> * pr-feedback Signed-off-by: Nathan Gauër <brioche@google.com> --------- Signed-off-by: Nathan Gauër <brioche@google.com>
This commit is contained in:
parent
707da36c70
commit
692529b941
@ -23,8 +23,10 @@
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef SOURCE_DISASSEMBLE_H_
|
||||
#define SOURCE_DISASSEMBLE_H_
|
||||
|
||||
#include <iosfwd>
|
||||
#include <ios>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@ -94,11 +94,11 @@ class InstructionDisassembler {
|
||||
// Emits an operand for the given instruction, where the instruction
|
||||
// is at offset words from the start of the binary.
|
||||
void EmitOperand(std::ostream& stream, const spv_parsed_instruction_t& inst,
|
||||
const uint16_t operand_index) const;
|
||||
uint16_t operand_index) const;
|
||||
|
||||
// Emits a mask expression for the given mask word of the specified type.
|
||||
void EmitMaskOperand(std::ostream& stream, const spv_operand_type_t type,
|
||||
const uint32_t word) const;
|
||||
void EmitMaskOperand(std::ostream& stream, spv_operand_type_t type,
|
||||
uint32_t word) const;
|
||||
|
||||
// Generate part of the instruction as a comment to be added to
|
||||
// |id_comments_|.
|
||||
|
@ -1790,6 +1790,7 @@ bool CompositeExtractFeedingConstruct(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
assert(first_element_inst != nullptr);
|
||||
|
||||
// The last check it to see that the object being extracted from is the
|
||||
// correct type.
|
||||
|
@ -499,6 +499,7 @@ Pass::Status LoopFissionPass::Process() {
|
||||
// next iteration.
|
||||
if (split_multiple_times_) {
|
||||
inner_most_loops = std::move(new_loops_to_split);
|
||||
new_loops_to_split = {};
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp,
|
||||
case spv::Op::OpTypeSampler:
|
||||
case spv::Op::OpTypeImage:
|
||||
if (vstate.HasCapability(spv::Capability::BindlessTextureNV))
|
||||
return baseAlignment = vstate.samplerimage_variable_address_mode() / 8;
|
||||
return vstate.samplerimage_variable_address_mode() / 8;
|
||||
assert(0);
|
||||
return 0;
|
||||
case spv::Op::OpTypeInt:
|
||||
|
@ -283,7 +283,7 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _,
|
||||
function_type->GetOperandAs<uint32_t>(param_index);
|
||||
const auto parameter_type = _.FindDef(parameter_type_id);
|
||||
if (!parameter_type || argument_type->id() != parameter_type->id()) {
|
||||
if (!_.options()->before_hlsl_legalization ||
|
||||
if (!parameter_type || !_.options()->before_hlsl_legalization ||
|
||||
!DoPointeesLogicallyMatch(argument_type, parameter_type, _)) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpFunctionCall Argument <id> " << _.getIdName(argument_id)
|
||||
|
@ -390,9 +390,8 @@ spv_result_t ValidateGroupNonUniformRotateKHR(ValidationState_t& _,
|
||||
if (inst->words().size() > 6) {
|
||||
const uint32_t cluster_size_op_id = inst->GetOperandAs<uint32_t>(5);
|
||||
const Instruction* cluster_size_inst = _.FindDef(cluster_size_op_id);
|
||||
const uint32_t cluster_size_type =
|
||||
cluster_size_inst ? cluster_size_inst->type_id() : 0;
|
||||
if (!_.IsUnsignedIntScalarType(cluster_size_type)) {
|
||||
if (!cluster_size_inst ||
|
||||
!_.IsUnsignedIntScalarType(cluster_size_inst->type_id())) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "ClusterSize must be a scalar of integer type, whose "
|
||||
"Signedness operand is 0.";
|
||||
|
@ -846,9 +846,6 @@ TEST_P(CapabilitySetForEachTest, MoveConstructor) {
|
||||
CapabilitySet copy(GetParam().capabilities);
|
||||
CapabilitySet moved(std::move(copy));
|
||||
EXPECT_THAT(ElementsIn(moved), Eq(GetParam().expected));
|
||||
|
||||
// The moved-from set is empty.
|
||||
EXPECT_THAT(ElementsIn(copy), Eq(std::vector<spv::Capability>{}));
|
||||
}
|
||||
|
||||
TEST_P(CapabilitySetForEachTest, OperatorEquals) {
|
||||
@ -858,7 +855,7 @@ TEST_P(CapabilitySetForEachTest, OperatorEquals) {
|
||||
|
||||
TEST_P(CapabilitySetForEachTest, OperatorEqualsSelfAssign) {
|
||||
CapabilitySet assigned{GetParam().capabilities};
|
||||
assigned = assigned;
|
||||
assigned = assigned; // NOLINT
|
||||
EXPECT_THAT(ElementsIn(assigned), Eq(GetParam().expected));
|
||||
}
|
||||
|
||||
|
@ -871,6 +871,7 @@ TEST_F(IRContextTest, AsanErrorTest) {
|
||||
opt::Function* fun =
|
||||
context->cfg()->block(5)->GetParent(); // Computes the CFG analysis
|
||||
opt::DominatorAnalysis* dom = nullptr;
|
||||
// NOLINTNEXTLINE
|
||||
dom = context->GetDominatorAnalysis(fun); // Computes the dominator analysis,
|
||||
// which depends on the CFG
|
||||
// analysis
|
||||
|
@ -184,7 +184,7 @@ TEST_F(PropagatorTest, PropagateThroughPhis) {
|
||||
}
|
||||
} else if (instr->opcode() == spv::Op::OpPhi) {
|
||||
phi_instr = instr;
|
||||
SSAPropagator::PropStatus retval;
|
||||
SSAPropagator::PropStatus retval = SSAPropagator::kNotInteresting;
|
||||
for (uint32_t i = 2; i < instr->NumOperands(); i += 2) {
|
||||
uint32_t phi_arg_id = instr->GetSingleWordOperand(i);
|
||||
auto it = values_.find(phi_arg_id);
|
||||
|
@ -12,6 +12,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <gtest/gtest-param-test.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "spirv-tools/optimizer.hpp"
|
||||
#include "test/opt/pass_fixture.h"
|
||||
#include "test/opt/pass_utils.h"
|
||||
|
Loading…
Reference in New Issue
Block a user