Fix some clang-tidy issues in graphics_robust_access_pass (#2998)

One remains: the fact that the image-texel-pointer modification
is mostly dead code. But that's intentional for now.
This commit is contained in:
David Neto 2019-10-30 14:00:34 -04:00 committed by GitHub
parent 466908b500
commit 618ee50942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -160,7 +160,6 @@
namespace spvtools { namespace spvtools {
namespace opt { namespace opt {
using opt::BasicBlock;
using opt::Instruction; using opt::Instruction;
using opt::Operand; using opt::Operand;
using spvtools::MakeUnique; using spvtools::MakeUnique;

View File

@ -81,8 +81,8 @@ class GraphicsRobustAccessPass : public Pass {
// sign extension or zero extension. The new instruction is inserted // sign extension or zero extension. The new instruction is inserted
// immediately before |before_inst|, and is analyzed for definitions and uses. // immediately before |before_inst|, and is analyzed for definitions and uses.
// Returns the newly inserted instruction. Assumes the |value| is an integer // Returns the newly inserted instruction. Assumes the |value| is an integer
// scalar of a narrower type than |bitwidth| bits. // scalar of a narrower type than |bit_width| bits.
Instruction* WidenInteger(bool sign_extend, uint32_t bitwidth, Instruction* WidenInteger(bool sign_extend, uint32_t bit_width,
Instruction* value, Instruction* before_inst); Instruction* value, Instruction* before_inst);
// Returns a new instruction that invokes the UClamp GLSL.std.450 extended // Returns a new instruction that invokes the UClamp GLSL.std.450 extended
@ -109,7 +109,8 @@ class GraphicsRobustAccessPass : public Pass {
// the module is modified. Returns a status code to indicate success // the module is modified. Returns a status code to indicate success
// or failure. If assumptions are not met, returns an error status code // or failure. If assumptions are not met, returns an error status code
// and emits a diagnostic. // and emits a diagnostic.
spv_result_t ClampCoordinateForImageTexelPointer(opt::Instruction* itp); spv_result_t ClampCoordinateForImageTexelPointer(
opt::Instruction* image_texel_pointer);
// Gets the instruction that defines the given id. // Gets the instruction that defines the given id.
opt::Instruction* GetDef(uint32_t id) { opt::Instruction* GetDef(uint32_t id) {

View File

@ -199,11 +199,11 @@ std::string ACCheck(const std::string& access_chain_inst,
const std::string& original, const std::string& original,
const std::string& transformed) { const std::string& transformed) {
return "\n ; CHECK: %ac = " + access_chain_inst + " %ptr_ty %var" + return "\n ; CHECK: %ac = " + access_chain_inst + " %ptr_ty %var" +
(transformed.size() ? " " : "") + transformed + (transformed.empty() ? "" : " ") + transformed +
"\n ; CHECK-NOT: " + access_chain_inst + "\n ; CHECK-NOT: " + access_chain_inst +
"\n ; CHECK-NEXT: OpReturn" "\n ; CHECK-NEXT: OpReturn"
"\n %ac = " + "\n %ac = " +
access_chain_inst + " %ptr_ty %var " + (original.size() ? " " : "") + access_chain_inst + " %ptr_ty %var " + (original.empty() ? "" : " ") +
original + "\n"; original + "\n";
} }
@ -211,11 +211,11 @@ std::string ACCheckFail(const std::string& access_chain_inst,
const std::string& original, const std::string& original,
const std::string& transformed) { const std::string& transformed) {
return "\n ; CHECK: %ac = " + access_chain_inst + " %ptr_ty %var" + return "\n ; CHECK: %ac = " + access_chain_inst + " %ptr_ty %var" +
(transformed.size() ? " " : "") + transformed + (transformed.empty() ? "" : " ") + transformed +
"\n ; CHECK-NOT: " + access_chain_inst + "\n ; CHECK-NOT: " + access_chain_inst +
"\n ; CHECK-NOT: OpReturn" "\n ; CHECK-NOT: OpReturn"
"\n %ac = " + "\n %ac = " +
access_chain_inst + " %ptr_ty %var " + (original.size() ? " " : "") + access_chain_inst + " %ptr_ty %var " + (original.empty() ? "" : " ") +
original + "\n"; original + "\n";
} }