summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2018-08-07 09:09:47 -0400
committerGitHub <noreply@github.com>2018-08-07 09:09:47 -0400
commit9991d661f83e1e6cd9b5d844c7524a158ce960ce (patch)
tree4c7138d8b78d64de3580d255f9ddde97ae724bf3
parenteda2cfbe128e5b71e9a0131f816ade5186ad6420 (diff)
Fix readbility/braces warnings (#1804)
-rw-r--r--PRESUBMIT.py1
-rw-r--r--source/comp/markv_codec.cpp2
-rw-r--r--source/opt/common_uniform_elim_pass.cpp2
-rw-r--r--source/opt/constants.h7
-rw-r--r--source/opt/dominator_tree.cpp3
-rw-r--r--source/opt/fold_spec_constant_op_and_composite_pass.cpp4
-rw-r--r--source/opt/ir_context.cpp2
-rw-r--r--source/opt/ir_context.h2
-rw-r--r--source/opt/loop_unswitch_pass.cpp4
-rw-r--r--source/text_handler.cpp4
-rw-r--r--source/val/validate_image.cpp20
11 files changed, 27 insertions, 24 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index ebf4fd32..e59fdfb1 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -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",
diff --git a/source/comp/markv_codec.cpp b/source/comp/markv_codec.cpp
index 2956d8ed..931c4c24 100644
--- a/source/comp/markv_codec.cpp
+++ b/source/comp/markv_codec.cpp
@@ -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() {
diff --git a/source/opt/common_uniform_elim_pass.cpp b/source/opt/common_uniform_elim_pass.cpp
index f7fe0b9e..e6426a55 100644
--- a/source/opt/common_uniform_elim_pass.cpp
+++ b/source/opt/common_uniform_elim_pass.cpp
@@ -284,7 +284,7 @@ bool CommonUniformElimPass::UniformAccessChainConvert(Function* func) {
inst = ReplaceAndDeleteLoad(inst, replId, ptrInst);
inst = inst->InsertBefore(std::move(newInsts));
modified = true;
- };
+ }
}
return modified;
}
diff --git a/source/opt/constants.h b/source/opt/constants.h
index 6fb22a53..ff23912f 100644
--- a/source/opt/constants.h
+++ b/source/opt/constants.h
@@ -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;
}
};
diff --git a/source/opt/dominator_tree.cpp b/source/opt/dominator_tree.cpp
index fc600d24..c9346e1c 100644
--- a/source/opt/dominator_tree.cpp
+++ b/source/opt/dominator_tree.cpp
@@ -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;
}
diff --git a/source/opt/fold_spec_constant_op_and_composite_pass.cpp b/source/opt/fold_spec_constant_op_and_composite_pass.cpp
index 4692d150..8bf7b54e 100644
--- a/source/opt/fold_spec_constant_op_and_composite_pass.cpp
+++ b/source/opt/fold_spec_constant_op_and_composite_pass.cpp
@@ -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;
}
}
diff --git a/source/opt/ir_context.cpp b/source/opt/ir_context.cpp
index de007585..742ac1f6 100644
--- a/source/opt/ir_context.cpp
+++ b/source/opt/ir_context.cpp
@@ -192,7 +192,7 @@ bool IRContext::ReplaceAllUsesWith(uint32_t before, uint32_t after) {
user->SetInOperand(in_operand_pos, {after});
}
AnalyzeUses(user);
- };
+ }
return true;
}
diff --git a/source/opt/ir_context.h b/source/opt/ir_context.h
index 95b5db52..af736bcb 100644
--- a/source/opt/ir_context.h
+++ b/source/opt/ir_context.h
@@ -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
diff --git a/source/opt/loop_unswitch_pass.cpp b/source/opt/loop_unswitch_pass.cpp
index 8215cb69..59a0cbcd 100644
--- a/source/opt/loop_unswitch_pass.cpp
+++ b/source/opt/loop_unswitch_pass.cpp
@@ -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 :
diff --git a/source/text_handler.cpp b/source/text_handler.cpp
index 37b47fc0..5f6e8c41 100644
--- a/source/text_handler.cpp
+++ b/source/text_handler.cpp
@@ -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;
diff --git a/source/val/validate_image.cpp b/source/val/validate_image.cpp
index f2be9dca..3f3f623a 100644
--- a/source/val/validate_image.cpp
+++ b/source/val/validate_image.cpp
@@ -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) {