mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
sem::StructMember: Add Type()
Once the AST switches to pure ast::Type nodes, we need a way to fetch the semantic type for a structure member. Bug: tint:724 Change-Id: I4b55c1ec0220e29ca4ff3131cf2d41409821a538 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49347 Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
109b18f504
commit
2ac55febf5
@@ -50,10 +50,15 @@ const StructMember* Struct::FindMember(Symbol name) const {
|
||||
}
|
||||
|
||||
StructMember::StructMember(ast::StructMember* declaration,
|
||||
sem::Type* type,
|
||||
uint32_t offset,
|
||||
uint32_t align,
|
||||
uint32_t size)
|
||||
: declaration_(declaration), offset_(offset), align_(align), size_(size) {}
|
||||
: declaration_(declaration),
|
||||
type_(type),
|
||||
offset_(offset),
|
||||
align_(align),
|
||||
size_(size) {}
|
||||
|
||||
StructMember::~StructMember() = default;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace sem {
|
||||
// Forward declarations
|
||||
class StructType;
|
||||
class StructMember;
|
||||
class Type;
|
||||
|
||||
/// A vector of StructMember pointers.
|
||||
using StructMemberList = std::vector<const StructMember*>;
|
||||
@@ -141,10 +142,12 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param type the type of the member
|
||||
/// @param offset the byte offset from the base of the structure
|
||||
/// @param align the byte alignment of the member
|
||||
/// @param size the byte size of the member
|
||||
StructMember(ast::StructMember* declaration,
|
||||
sem::Type* type,
|
||||
uint32_t offset,
|
||||
uint32_t align,
|
||||
uint32_t size);
|
||||
@@ -155,6 +158,9 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
/// @returns the AST declaration node
|
||||
ast::StructMember* Declaration() const { return declaration_; }
|
||||
|
||||
/// @returns the type of the member
|
||||
sem::Type* Type() const { return type_; }
|
||||
|
||||
/// @returns byte offset from base of structure
|
||||
uint32_t Offset() const { return offset_; }
|
||||
|
||||
@@ -166,6 +172,7 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
|
||||
private:
|
||||
ast::StructMember* const declaration_;
|
||||
sem::Type* const type_;
|
||||
uint32_t const offset_; // Byte offset from base of structure
|
||||
uint32_t const align_; // Byte alignment of the member
|
||||
uint32_t const size_; // Byte size of the member
|
||||
|
||||
Reference in New Issue
Block a user