writer/[hlsl,msl]: Default `name_printed` to false
Addresses the review comment: https://dawn-review.googlesource.com/c/tint/+/59302/4/src/writer/msl/generator_impl.cc#1932 Change-Id: I4cd6e0e626748328ca2bacc74aa9127cb224cf4a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59448 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
parent
294cb95f0e
commit
48411444b4
|
@ -2912,6 +2912,9 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
ast::Access access,
|
||||
const std::string& name,
|
||||
bool* name_printed /* = nullptr */) {
|
||||
if (name_printed) {
|
||||
*name_printed = false;
|
||||
}
|
||||
switch (storage_class) {
|
||||
case ast::StorageClass::kStorage:
|
||||
if (access != ast::Access::kRead) {
|
||||
|
@ -3091,11 +3094,11 @@ bool GeneratorImpl::EmitTypeAndName(std::ostream& out,
|
|||
ast::StorageClass storage_class,
|
||||
ast::Access access,
|
||||
const std::string& name) {
|
||||
bool printed_name = false;
|
||||
if (!EmitType(out, type, storage_class, access, name, &printed_name)) {
|
||||
bool name_printed = false;
|
||||
if (!EmitType(out, type, storage_class, access, name, &name_printed)) {
|
||||
return false;
|
||||
}
|
||||
if (!name.empty() && !printed_name) {
|
||||
if (!name.empty() && !name_printed) {
|
||||
out << " " << name;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1930,6 +1930,9 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
const sem::Type* type,
|
||||
const std::string& name,
|
||||
bool* name_printed /* = nullptr */) {
|
||||
if (name_printed) {
|
||||
*name_printed = false;
|
||||
}
|
||||
if (auto* atomic = type->As<sem::Atomic>()) {
|
||||
if (atomic->Type()->Is<sem::I32>()) {
|
||||
out << "atomic_int";
|
||||
|
@ -2000,12 +2003,12 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
out << " ";
|
||||
if (ptr->StoreType()->Is<sem::Array>()) {
|
||||
std::string inner = "(*" + name + ")";
|
||||
if (name_printed) {
|
||||
*name_printed = true;
|
||||
}
|
||||
if (!EmitType(out, ptr->StoreType(), inner)) {
|
||||
return false;
|
||||
}
|
||||
if (name_printed) {
|
||||
*name_printed = true;
|
||||
}
|
||||
} else {
|
||||
if (!EmitType(out, ptr->StoreType(), "")) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue