mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-22 11:40:05 +00:00
Fix readbility/braces warnings (#1804)
This commit is contained in:
parent
eda2cfbe12
commit
9991d661f8
@ -20,7 +20,6 @@ for more details about the presubmit API built into depot_tools.
|
||||
|
||||
LINT_FILTERS = [
|
||||
"-build/storage_class",
|
||||
"-readability/braces",
|
||||
"-readability/casting",
|
||||
"-readability/fn_size",
|
||||
"-readability/inheritance",
|
||||
|
@ -765,7 +765,7 @@ class MarkvDecoder : public MarkvCodecBase {
|
||||
const bool result = reader_.ReadBits(&bits, 1);
|
||||
if (result) *bit = bits ? true : false;
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
// Returns ReadBit bound to the class object.
|
||||
std::function<bool(bool*)> GetReadBitCallback() {
|
||||
|
@ -284,7 +284,7 @@ bool CommonUniformElimPass::UniformAccessChainConvert(Function* func) {
|
||||
inst = ReplaceAndDeleteLoad(inst, replId, ptrInst);
|
||||
inst = inst->InsertBefore(std::move(newInsts));
|
||||
modified = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class Constant {
|
||||
int64_t GetS64() const;
|
||||
|
||||
// Returns true if the constant is a zero or a composite containing 0s.
|
||||
virtual bool IsZero() const { return false; };
|
||||
virtual bool IsZero() const { return false; }
|
||||
|
||||
const Type* type() const { return type_; }
|
||||
|
||||
@ -481,10 +481,11 @@ struct ConstantEqual {
|
||||
const auto& composite2 = c2->AsCompositeConstant();
|
||||
return composite2 &&
|
||||
composite1->GetComponents() == composite2->GetComponents();
|
||||
} else if (c1->AsNullConstant())
|
||||
} else if (c1->AsNullConstant()) {
|
||||
return c2->AsNullConstant() != nullptr;
|
||||
else
|
||||
} else {
|
||||
assert(false && "Tried to compare two invalid Constant instances.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
@ -278,8 +278,9 @@ DominatorTreeNode* DominatorTree::GetOrInsertNode(BasicBlock* bb) {
|
||||
if (node_iter == nodes_.end()) {
|
||||
dtn = &nodes_.emplace(std::make_pair(bb->id(), DominatorTreeNode{bb}))
|
||||
.first->second;
|
||||
} else
|
||||
} else {
|
||||
dtn = &node_iter->second;
|
||||
}
|
||||
|
||||
return dtn;
|
||||
}
|
||||
|
@ -302,9 +302,9 @@ bool IsValidTypeForComponentWiseOperation(const analysis::Type* type) {
|
||||
} else if (auto* it = type->AsInteger()) {
|
||||
if (it->width() == 32) return true;
|
||||
} else if (auto* vt = type->AsVector()) {
|
||||
if (vt->element_type()->AsBool())
|
||||
if (vt->element_type()->AsBool()) {
|
||||
return true;
|
||||
else if (auto* vit = vt->element_type()->AsInteger()) {
|
||||
} else if (auto* vit = vt->element_type()->AsInteger()) {
|
||||
if (vit->width() == 32) return true;
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ bool IRContext::ReplaceAllUsesWith(uint32_t before, uint32_t after) {
|
||||
user->SetInOperand(in_operand_pos, {after});
|
||||
}
|
||||
AnalyzeUses(user);
|
||||
};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ class IRContext {
|
||||
BuildDecorationManager();
|
||||
}
|
||||
return decoration_mgr_.get();
|
||||
};
|
||||
}
|
||||
|
||||
// Returns a pointer to the constant manager. If no constant manager has been
|
||||
// created yet, it creates one. NOTE: Once created, the constant manager
|
||||
|
@ -731,8 +731,10 @@ class LoopUnswitch {
|
||||
context_->KillInst(merge);
|
||||
}
|
||||
dead_loops[loop] = loop->GetParent();
|
||||
} else
|
||||
} else {
|
||||
dead_loops[loop] = loop;
|
||||
}
|
||||
|
||||
// For each loop, check if we killed it. If we did, find a suitable parent
|
||||
// for its children.
|
||||
for (Loop& sub_loop :
|
||||
|
@ -107,9 +107,9 @@ spv_result_t getWord(spv_text text, spv_position position, std::string* word) {
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
const char ch = text->str[position->index];
|
||||
if (ch == '\\')
|
||||
if (ch == '\\') {
|
||||
escaping = !escaping;
|
||||
else {
|
||||
} else {
|
||||
switch (ch) {
|
||||
case '"':
|
||||
if (!escaping) quoting = !quoting;
|
||||
|
@ -118,7 +118,7 @@ bool IsImplicitLod(SpvOp opcode) {
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ bool IsExplicitLod(SpvOp opcode) {
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ bool IsProj(SpvOp opcode) {
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image Operands Offset, ConstOffset, ConstOffsets cannot be used "
|
||||
<< "together";
|
||||
};
|
||||
}
|
||||
|
||||
const bool is_implicit_lod = IsImplicitLod(opcode);
|
||||
const bool is_explicit_lod = IsExplicitLod(opcode);
|
||||
@ -238,7 +238,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
|
||||
if (!is_implicit_lod) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image Operand Bias can only be used with ImplicitLod opcodes";
|
||||
};
|
||||
}
|
||||
|
||||
const uint32_t type_id = _.GetTypeId(inst->word(word_index++));
|
||||
if (!_.IsFloatScalarType(type_id)) {
|
||||
@ -265,7 +265,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image Operand Lod can only be used with ExplicitLod opcodes "
|
||||
<< "and OpImageFetch";
|
||||
};
|
||||
}
|
||||
|
||||
if (mask & SpvImageOperandsGradMask) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
@ -305,7 +305,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
|
||||
if (!is_explicit_lod) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image Operand Grad can only be used with ExplicitLod opcodes";
|
||||
};
|
||||
}
|
||||
|
||||
const uint32_t dx_type_id = _.GetTypeId(inst->word(word_index++));
|
||||
const uint32_t dy_type_id = _.GetTypeId(inst->word(word_index++));
|
||||
@ -465,7 +465,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image Operand MinLod can only be used with ImplicitLod "
|
||||
<< "opcodes or together with Image Operand Grad";
|
||||
};
|
||||
}
|
||||
|
||||
const uint32_t type_id = _.GetTypeId(inst->word(word_index++));
|
||||
if (!_.IsFloatScalarType(type_id)) {
|
||||
@ -1281,7 +1281,7 @@ spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _,
|
||||
default:
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image 'Dim' must be 1D, 2D, 3D or Cube";
|
||||
};
|
||||
}
|
||||
|
||||
if (info.multisampled != 0) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'MS' must be 0";
|
||||
@ -1352,7 +1352,7 @@ spv_result_t ValidateImageQuerySize(ValidationState_t& _,
|
||||
default:
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Image 'Dim' must be Buffer, 2D, 3D or Rect";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (info.multisampled != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user