tint/writer: Minor generator cleanup.
No-op change.
Change-Id: Ic5057bbacea09c6ed57d4f735a18d6c1040f1f5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94332
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index ba19a37..c40194e 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -388,11 +388,10 @@
return false;
}
}
- out << "(";
+ ScopedParen sp(out);
if (!EmitExpression(out, expr->expr)) {
return false;
}
- out << ")";
return true;
}
@@ -432,7 +431,7 @@
default:
break;
}
- out << "(";
+ ScopedParen sp(out);
if (!EmitExpression(out, expr->lhs)) {
return false;
}
@@ -440,7 +439,6 @@
if (!EmitExpression(out, expr->rhs)) {
return false;
}
- out << ")";
return true;
}
@@ -594,7 +592,7 @@
return EmitFloatModulo(out, expr);
}
- out << "(";
+ ScopedParen sp(out);
if (!EmitExpression(out, expr->lhs)) {
return false;
}
@@ -670,7 +668,6 @@
return false;
}
- out << ")";
return true;
}
@@ -730,7 +727,8 @@
auto name = builder_.Symbols().NameFor(ident->symbol);
auto caller_sym = ident->symbol;
- out << name << "(";
+ out << name;
+ ScopedParen sp(out);
bool first = true;
for (auto* arg : args) {
@@ -744,7 +742,6 @@
}
}
- out << ")";
return true;
}
@@ -809,7 +806,8 @@
return false;
}
- out << name << "(";
+ out << name;
+ ScopedParen sp(out);
bool first = true;
for (auto* arg : call->Arguments()) {
@@ -823,7 +821,6 @@
}
}
- out << ")";
return true;
}
@@ -833,13 +830,12 @@
if (!EmitType(out, conv->Target(), ast::StorageClass::kNone, ast::Access::kReadWrite, "")) {
return false;
}
- out << "(";
+ ScopedParen sp(out);
if (!EmitExpression(out, call->Arguments()[0]->Declaration())) {
return false;
}
- out << ")";
return true;
}
@@ -1183,7 +1179,9 @@
}
}
- out << fn << "(";
+ out << fn;
+ ScopedParen sp(out);
+
if (!EmitExpression(out, expr->args[0])) {
return false;
}
@@ -1191,7 +1189,6 @@
if (!EmitExpression(out, expr->args[1])) {
return false;
}
- out << ")";
return true;
}
@@ -2352,7 +2349,7 @@
return false;
}
bool first = true;
- out << "(";
+ ScopedParen sp(out);
for (auto* member : str->Members()) {
if (!first) {
out << ", ";
@@ -2361,19 +2358,17 @@
}
EmitZeroValue(out, member->Type());
}
- out << ")";
} else if (auto* array = type->As<sem::Array>()) {
if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, "")) {
return false;
}
- out << "(";
+ ScopedParen sp(out);
for (uint32_t i = 0; i < array->Count(); i++) {
if (i != 0) {
out << ", ";
}
EmitZeroValue(out, array->ElemType());
}
- out << ")";
} else {
diagnostics_.add_error(diag::System::Writer, "Invalid type for zero emission: " +
type->FriendlyName(builder_.Symbols()));
@@ -2925,14 +2920,12 @@
out << "-";
break;
}
- out << "(";
+ ScopedParen sp(out);
if (!EmitExpression(out, expr->expr)) {
return false;
}
- out << ")";
-
return true;
}
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index 0533826..a053ad4 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -3709,9 +3709,8 @@
while (auto* arr = base_type->As<sem::Array>()) {
if (arr->IsRuntimeSized()) {
TINT_ICE(Writer, diagnostics_)
- << "Runtime arrays may only exist in storage buffers, which "
- "should "
- "have been transformed into a ByteAddressBuffer";
+ << "Runtime arrays may only exist in storage buffers, which should have "
+ "been transformed into a ByteAddressBuffer";
return false;
}
sizes.push_back(arr->Count());