tint: Use type::Struct::Name in CreateASTTypeFor
The declaration may be nullptr, so doing this avoids a potential nullptr deref when the struct is an internal type (e.g. frexp result). In these cases we will now fail to resolve the resulting code, which is a little better than just crashing. A future change will update the resolver to allow us to use the internal struct names from our transforms. Bug: chromium:1430309 Change-Id: Ic72b5105bf3159c448c20dd9228d73b25a632b69 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129120 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
2dc9fe842d
commit
99a0ded622
|
@ -144,7 +144,7 @@ ast::Type Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type* ty) {
|
||||||
return ctx.dst->ty.array(el, u32(count.value()), std::move(attrs));
|
return ctx.dst->ty.array(el, u32(count.value()), std::move(attrs));
|
||||||
}
|
}
|
||||||
if (auto* s = ty->As<sem::Struct>()) {
|
if (auto* s = ty->As<sem::Struct>()) {
|
||||||
return ctx.dst->ty(ctx.Clone(s->Declaration()->name->symbol));
|
return ctx.dst->ty(ctx.Clone(s->Name()));
|
||||||
}
|
}
|
||||||
if (auto* s = ty->As<type::Reference>()) {
|
if (auto* s = ty->As<type::Reference>()) {
|
||||||
return CreateASTTypeFor(ctx, s->StoreType());
|
return CreateASTTypeFor(ctx, s->StoreType());
|
||||||
|
|
Loading…
Reference in New Issue