Rename semantic to sem

* Rename namespace semantic to sem
* Rename directory src/semantic/ to src/sem/

Bug: tint:724
Change-Id: I76383b821fbca7f1037a803c497b595a706dcb06
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48120
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano 2021-04-16 19:07:51 +00:00 committed by Commit Bot service account
parent 26cd48603d
commit 5cd71b8c0a
174 changed files with 847 additions and 866 deletions

View File

@ -115,7 +115,7 @@ type nodes.
## Semantic information
Semantic information is held by `semantic::Node`s which describe the program at
Semantic information is held by `sem::Node`s which describe the program at
a higher / more abstract level than the AST. This includes information such as
the resolved type of each expression, the resolved overload of an intrinsic
function call, and the module scoped variables used by each function.
@ -123,11 +123,11 @@ function call, and the module scoped variables used by each function.
Semantic information is generated by the `Resolver` when the `Program`
is built from a `ProgramBuilder`.
The `semantic::Info` class holds a map of `ast::Node`s to `semantic::Node`s.
The `sem::Info` class holds a map of `ast::Node`s to `sem::Node`s.
This map is **many-to-one** - i.e. while a AST node might have a single
corresponding semantic node, the reverse may not be true. For example:
many `ast::IdentifierExpression` nodes may map to a single `semantic::Variable`,
and so the `semantic::Variable` does not have a single corresponding
many `ast::IdentifierExpression` nodes may map to a single `sem::Variable`,
and so the `sem::Variable` does not have a single corresponding
`ast::Node`.
Unlike `ast::Node`s, semantic nodes may not necessarily form a directed acyclic

View File

@ -362,37 +362,37 @@ source_set("libtint_core_src") {
"inspector/scalar.h",
"intrinsic_table.cc",
"intrinsic_table.h",
"program_id.cc",
"program_id.h",
"program.cc",
"program.h",
"program_builder.cc",
"program_builder.h",
"program_id.cc",
"program_id.h",
"reader/reader.cc",
"reader/reader.h",
"resolver/resolver.cc",
"resolver/resolver.h",
"scope_stack.h",
"semantic/array.h",
"semantic/call.h",
"semantic/call_target.h",
"semantic/expression.h",
"semantic/info.h",
"semantic/intrinsic.h",
"semantic/node.h",
"semantic/sem_array.cc",
"semantic/sem_call.cc",
"semantic/sem_call_target.cc",
"semantic/sem_expression.cc",
"semantic/sem_function.cc",
"semantic/sem_info.cc",
"semantic/sem_intrinsic.cc",
"semantic/sem_member_accessor_expression.cc",
"semantic/sem_node.cc",
"semantic/sem_statement.cc",
"semantic/sem_struct.cc",
"semantic/sem_variable.cc",
"semantic/type_mappings.h",
"sem/array.h",
"sem/call.h",
"sem/call_target.h",
"sem/expression.h",
"sem/info.h",
"sem/intrinsic.h",
"sem/node.h",
"sem/sem_array.cc",
"sem/sem_call.cc",
"sem/sem_call_target.cc",
"sem/sem_expression.cc",
"sem/sem_function.cc",
"sem/sem_info.cc",
"sem/sem_intrinsic.cc",
"sem/sem_member_accessor_expression.cc",
"sem/sem_node.cc",
"sem/sem_statement.cc",
"sem/sem_struct.cc",
"sem/sem_variable.cc",
"sem/type_mappings.h",
"source.cc",
"source.h",
"symbol.cc",

View File

@ -188,26 +188,26 @@ set(TINT_LIB_SRCS
resolver/resolver.cc
resolver/resolver.h
scope_stack.h
semantic/array.h
semantic/call.h
semantic/call_target.h
semantic/expression.h
semantic/info.h
semantic/intrinsic.h
semantic/node.h
semantic/sem_array.cc
semantic/sem_call.cc
semantic/sem_call_target.cc
semantic/sem_expression.cc
semantic/sem_member_accessor_expression.cc
semantic/sem_function.cc
semantic/sem_info.cc
semantic/sem_intrinsic.cc
semantic/sem_node.cc
semantic/sem_statement.cc
semantic/sem_struct.cc
semantic/sem_variable.cc
semantic/type_mappings.h
sem/array.h
sem/call.h
sem/call_target.h
sem/expression.h
sem/info.h
sem/intrinsic.h
sem/node.h
sem/sem_array.cc
sem/sem_call.cc
sem/sem_call_target.cc
sem/sem_expression.cc
sem/sem_member_accessor_expression.cc
sem/sem_function.cc
sem/sem_info.cc
sem/sem_intrinsic.cc
sem/sem_node.cc
sem/sem_statement.cc
sem/sem_struct.cc
sem/sem_variable.cc
sem/type_mappings.h
source.cc
source.h
symbol.cc
@ -496,7 +496,7 @@ if(${TINT_BUILD_TESTS})
resolver/type_validation_test.cc
resolver/validation_test.cc
scope_stack_test.cc
semantic/sem_intrinsic_test.cc
sem/sem_intrinsic_test.cc
symbol_table_test.cc
symbol_test.cc
traits_test.cc

View File

@ -28,7 +28,7 @@ AccessDecoration::AccessDecoration(ProgramID program_id,
AccessDecoration::~AccessDecoration() = default;
void AccessDecoration::to_str(const semantic::Info&,
void AccessDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -40,7 +40,7 @@ class AccessDecoration : public Castable<AccessDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -46,7 +46,7 @@ ArrayAccessorExpression* ArrayAccessorExpression::Clone(
return ctx->dst->create<ArrayAccessorExpression>(src, arr, idx);
}
void ArrayAccessorExpression::to_str(const semantic::Info& sem,
void ArrayAccessorExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -53,7 +53,7 @@ class ArrayAccessorExpression
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -44,7 +44,7 @@ AssignmentStatement* AssignmentStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<AssignmentStatement>(src, l, r);
}
void AssignmentStatement::to_str(const semantic::Info& sem,
void AssignmentStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -52,7 +52,7 @@ class AssignmentStatement : public Castable<AssignmentStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -46,7 +46,7 @@ BinaryExpression* BinaryExpression::Clone(CloneContext* ctx) const {
return ctx->dst->create<BinaryExpression>(src, op_, l, r);
}
void BinaryExpression::to_str(const semantic::Info& sem,
void BinaryExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -124,7 +124,7 @@ class BinaryExpression : public Castable<BinaryExpression, Expression> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -28,7 +28,7 @@ BindingDecoration::BindingDecoration(ProgramID program_id,
BindingDecoration::~BindingDecoration() = default;
void BindingDecoration::to_str(const semantic::Info&,
void BindingDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -37,7 +37,7 @@ class BindingDecoration : public Castable<BindingDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -42,7 +42,7 @@ BitcastExpression* BitcastExpression::Clone(CloneContext* ctx) const {
return ctx->dst->create<BitcastExpression>(src, ty, e);
}
void BitcastExpression::to_str(const semantic::Info& sem,
void BitcastExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -51,7 +51,7 @@ class BitcastExpression : public Castable<BitcastExpression, Expression> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -42,7 +42,7 @@ BlockStatement* BlockStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<BlockStatement>(src, stmts);
}
void BlockStatement::to_str(const semantic::Info& sem,
void BlockStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -81,7 +81,7 @@ class BlockStatement : public Castable<BlockStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -29,7 +29,7 @@ BoolLiteral::BoolLiteral(ProgramID program_id,
BoolLiteral::~BoolLiteral() = default;
std::string BoolLiteral::to_str(const semantic::Info&) const {
std::string BoolLiteral::to_str(const sem::Info&) const {
return value_ ? "true" : "false";
}

View File

@ -46,7 +46,7 @@ class BoolLiteral : public Castable<BoolLiteral, Literal> {
/// @param sem the semantic info for the program
/// @returns the literal as a string
std::string to_str(const semantic::Info& sem) const override;
std::string to_str(const sem::Info& sem) const override;
/// Clones this node and all transitive child nodes using the `CloneContext`
/// `ctx`.

View File

@ -34,7 +34,7 @@ BreakStatement* BreakStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<BreakStatement>(src);
}
void BreakStatement::to_str(const semantic::Info&,
void BreakStatement::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -41,7 +41,7 @@ class BreakStatement : public Castable<BreakStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -28,7 +28,7 @@ BuiltinDecoration::BuiltinDecoration(ProgramID program_id,
BuiltinDecoration::~BuiltinDecoration() = default;
void BuiltinDecoration::to_str(const semantic::Info&,
void BuiltinDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -40,7 +40,7 @@ class BuiltinDecoration : public Castable<BuiltinDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -46,7 +46,7 @@ CallExpression* CallExpression::Clone(CloneContext* ctx) const {
return ctx->dst->create<CallExpression>(src, fn, p);
}
void CallExpression::to_str(const semantic::Info& sem,
void CallExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -51,7 +51,7 @@ class CallExpression : public Castable<CallExpression, Expression> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -40,7 +40,7 @@ CallStatement* CallStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<CallStatement>(src, call);
}
void CallStatement::to_str(const semantic::Info& sem,
void CallStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
call_->to_str(sem, out, indent);

View File

@ -48,7 +48,7 @@ class CallStatement : public Castable<CallStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -46,7 +46,7 @@ CaseStatement* CaseStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<CaseStatement>(src, sel, b);
}
void CaseStatement::to_str(const semantic::Info& sem,
void CaseStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -62,7 +62,7 @@ class CaseStatement : public Castable<CaseStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -28,7 +28,7 @@ ConstantIdDecoration::ConstantIdDecoration(ProgramID program_id,
ConstantIdDecoration::~ConstantIdDecoration() = default;
void ConstantIdDecoration::to_str(const semantic::Info&,
void ConstantIdDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -39,7 +39,7 @@ class ConstantIdDecoration : public Castable<ConstantIdDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -34,7 +34,7 @@ ContinueStatement* ContinueStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<ContinueStatement>(src);
}
void ContinueStatement::to_str(const semantic::Info&,
void ContinueStatement::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -41,7 +41,7 @@ class ContinueStatement : public Castable<ContinueStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -34,7 +34,7 @@ DiscardStatement* DiscardStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<DiscardStatement>(src);
}
void DiscardStatement::to_str(const semantic::Info&,
void DiscardStatement::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -41,7 +41,7 @@ class DiscardStatement : public Castable<DiscardStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -43,7 +43,7 @@ ElseStatement* ElseStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<ElseStatement>(src, cond, b);
}
void ElseStatement::to_str(const semantic::Info& sem,
void ElseStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -59,7 +59,7 @@ class ElseStatement : public Castable<ElseStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -14,8 +14,8 @@
#include "src/ast/expression.h"
#include "src/semantic/expression.h"
#include "src/semantic/info.h"
#include "src/sem/expression.h"
#include "src/sem/info.h"
TINT_INSTANTIATE_TYPEINFO(tint::ast::Expression);
@ -29,7 +29,7 @@ Expression::Expression(Expression&&) = default;
Expression::~Expression() = default;
std::string Expression::result_type_str(const semantic::Info& sem) const {
std::string Expression::result_type_str(const sem::Info& sem) const {
auto* sem_expr = sem.Get(this);
return sem_expr ? sem_expr->Type()->type_name() : "not set";
}

View File

@ -40,7 +40,7 @@ class Expression : public Castable<Expression, Node> {
/// @param sem the semantic info for the program
/// @returns a string representation of the result type or 'not set' if no
/// result type present
std::string result_type_str(const semantic::Info& sem) const;
std::string result_type_str(const sem::Info& sem) const;
private:
Expression(const Expression&) = delete;

View File

@ -35,7 +35,7 @@ FallthroughStatement* FallthroughStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<FallthroughStatement>(src);
}
void FallthroughStatement::to_str(const semantic::Info&,
void FallthroughStatement::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -41,7 +41,7 @@ class FallthroughStatement : public Castable<FallthroughStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -31,7 +31,7 @@ FloatLiteral::FloatLiteral(ProgramID program_id,
FloatLiteral::~FloatLiteral() = default;
std::string FloatLiteral::to_str(const semantic::Info&) const {
std::string FloatLiteral::to_str(const sem::Info&) const {
return std::to_string(value_);
}

View File

@ -44,7 +44,7 @@ class FloatLiteral : public Castable<FloatLiteral, Literal> {
/// @param sem the semantic info for the program
/// @returns the literal as a string
std::string to_str(const semantic::Info& sem) const override;
std::string to_str(const sem::Info& sem) const override;
/// Clones this node and all transitive child nodes using the `CloneContext`
/// `ctx`.

View File

@ -88,7 +88,7 @@ Function* Function::Clone(CloneContext* ctx) const {
return ctx->dst->create<Function>(src, sym, p, ret, b, decos, ret_decos);
}
void Function::to_str(const semantic::Info& sem,
void Function::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);
@ -130,7 +130,7 @@ std::string Function::type_name() const {
out << "__func" + return_type_->type_name();
for (auto* param : params_) {
// No need for the semantic::Variable here, functions params must have a
// No need for the sem::Variable here, functions params must have a
// type
out << param->declared_type()->type_name();
}

View File

@ -102,7 +102,7 @@ class Function : public Castable<Function, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -28,7 +28,7 @@ GroupDecoration::GroupDecoration(ProgramID program_id,
GroupDecoration::~GroupDecoration() = default;
void GroupDecoration::to_str(const semantic::Info&,
void GroupDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -37,7 +37,7 @@ class GroupDecoration : public Castable<GroupDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -40,7 +40,7 @@ IdentifierExpression* IdentifierExpression::Clone(CloneContext* ctx) const {
return ctx->dst->create<IdentifierExpression>(src, sym);
}
void IdentifierExpression::to_str(const semantic::Info& sem,
void IdentifierExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -16,7 +16,7 @@
#define SRC_AST_IDENTIFIER_EXPRESSION_H_
#include "src/ast/expression.h"
#include "src/semantic/intrinsic.h"
#include "src/sem/intrinsic.h"
namespace tint {
namespace ast {
@ -46,7 +46,7 @@ class IdentifierExpression : public Castable<IdentifierExpression, Expression> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -53,7 +53,7 @@ IfStatement* IfStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<IfStatement>(src, cond, b, el);
}
void IfStatement::to_str(const semantic::Info& sem,
void IfStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -63,7 +63,7 @@ class IfStatement : public Castable<IfStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -24,7 +24,7 @@ InternalDecoration::InternalDecoration(ProgramID program_id)
InternalDecoration::~InternalDecoration() = default;
void InternalDecoration::to_str(const semantic::Info&,
void InternalDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -43,7 +43,7 @@ class InternalDecoration : public Castable<InternalDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;
};

View File

@ -24,7 +24,7 @@ Literal::Literal(ProgramID program_id, const Source& source, type::Type* type)
Literal::~Literal() = default;
void Literal::to_str(const semantic::Info& sem,
void Literal::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -34,13 +34,13 @@ class Literal : public Castable<Literal, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;
/// @param sem the semantic info for the program
/// @returns the literal as a string
virtual std::string to_str(const semantic::Info& sem) const = 0;
virtual std::string to_str(const sem::Info& sem) const = 0;
/// @returns the name for this literal. This name is unique to this value.
virtual std::string name() const = 0;

View File

@ -28,7 +28,7 @@ LocationDecoration::LocationDecoration(ProgramID program_id,
LocationDecoration::~LocationDecoration() = default;
void LocationDecoration::to_str(const semantic::Info&,
void LocationDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -39,7 +39,7 @@ class LocationDecoration : public Castable<LocationDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -43,7 +43,7 @@ LoopStatement* LoopStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<LoopStatement>(src, b, cont);
}
void LoopStatement::to_str(const semantic::Info& sem,
void LoopStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -60,7 +60,7 @@ class LoopStatement : public Castable<LoopStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -46,7 +46,7 @@ MemberAccessorExpression* MemberAccessorExpression::Clone(
return ctx->dst->create<MemberAccessorExpression>(src, str, mem);
}
void MemberAccessorExpression::to_str(const semantic::Info& sem,
void MemberAccessorExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -52,7 +52,7 @@ class MemberAccessorExpression
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -74,7 +74,7 @@ void Module::Copy(CloneContext* ctx, const Module* src) {
}
}
void Module::to_str(const semantic::Info& sem,
void Module::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);
@ -102,7 +102,7 @@ void Module::to_str(const semantic::Info& sem,
out << "}" << std::endl;
}
std::string Module::to_str(const semantic::Info& sem) const {
std::string Module::to_str(const sem::Info& sem) const {
std::ostringstream out;
to_str(sem, out, 0);
return out.str();

View File

@ -105,13 +105,13 @@ class Module : public Castable<Module, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;
/// @param sem the semantic info for the program
/// @returns a string representation of the Builder
std::string to_str(const semantic::Info& sem) const;
std::string to_str(const sem::Info& sem) const;
private:
std::vector<Cloneable*> global_declarations_;

View File

@ -31,7 +31,7 @@ void Node::make_indent(std::ostream& out, size_t indent) const {
out << " ";
}
std::string Node::str(const semantic::Info& sem) const {
std::string Node::str(const sem::Info& sem) const {
std::ostringstream out;
to_str(sem, out, 0);
return out.str();

View File

@ -27,7 +27,7 @@ class CloneContext;
namespace type {
class Type;
}
namespace semantic {
namespace sem {
class Info;
}
@ -48,14 +48,14 @@ class Node : public Castable<Node, Cloneable> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
virtual void to_str(const semantic::Info& sem,
virtual void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const = 0;
/// Convenience wrapper around the to_str() method.
/// @param sem the semantic info for the program
/// @returns the node as a string
std::string str(const semantic::Info& sem) const;
std::string str(const sem::Info& sem) const;
protected:
/// Create a new node

View File

@ -42,7 +42,7 @@ ReturnStatement* ReturnStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<ReturnStatement>(src, ret);
}
void ReturnStatement::to_str(const semantic::Info& sem,
void ReturnStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -55,7 +55,7 @@ class ReturnStatement : public Castable<ReturnStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -42,7 +42,7 @@ ScalarConstructorExpression* ScalarConstructorExpression::Clone(
return ctx->dst->create<ScalarConstructorExpression>(src, lit);
}
void ScalarConstructorExpression::to_str(const semantic::Info& sem,
void ScalarConstructorExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -49,7 +49,7 @@ class ScalarConstructorExpression
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -29,7 +29,7 @@ SintLiteral::SintLiteral(ProgramID program_id,
SintLiteral::~SintLiteral() = default;
std::string SintLiteral::to_str(const semantic::Info&) const {
std::string SintLiteral::to_str(const sem::Info&) const {
return std::to_string(value());
}

View File

@ -44,7 +44,7 @@ class SintLiteral : public Castable<SintLiteral, IntLiteral> {
/// @param sem the semantic info for the program
/// @returns the literal as a string
std::string to_str(const semantic::Info& sem) const override;
std::string to_str(const sem::Info& sem) const override;
/// Clones this node and all transitive child nodes using the `CloneContext`
/// `ctx`.

View File

@ -28,7 +28,7 @@ StageDecoration::StageDecoration(ProgramID program_id,
StageDecoration::~StageDecoration() = default;
void StageDecoration::to_str(const semantic::Info&,
void StageDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -40,7 +40,7 @@ class StageDecoration : public Castable<StageDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -28,7 +28,7 @@ StrideDecoration::StrideDecoration(ProgramID program_id,
StrideDecoration::~StrideDecoration() = default;
void StrideDecoration::to_str(const semantic::Info&,
void StrideDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -37,7 +37,7 @@ class StrideDecoration : public Castable<StrideDecoration, Decoration> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -64,7 +64,7 @@ Struct* Struct::Clone(CloneContext* ctx) const {
return ctx->dst->create<Struct>(src, mem, decos);
}
void Struct::to_str(const semantic::Info& sem,
void Struct::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
out << "Struct{" << std::endl;

View File

@ -64,7 +64,7 @@ class Struct : public Castable<Struct, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -27,7 +27,7 @@ StructBlockDecoration::StructBlockDecoration(ProgramID program_id,
StructBlockDecoration::~StructBlockDecoration() = default;
void StructBlockDecoration::to_str(const semantic::Info&,
void StructBlockDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -36,7 +36,7 @@ class StructBlockDecoration
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -64,7 +64,7 @@ StructMember* StructMember::Clone(CloneContext* ctx) const {
return ctx->dst->create<StructMember>(src, sym, ty, decos);
}
void StructMember::to_str(const semantic::Info& sem,
void StructMember::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -65,7 +65,7 @@ class StructMember : public Castable<StructMember, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -29,7 +29,7 @@ StructMemberAlignDecoration::StructMemberAlignDecoration(ProgramID program_id,
StructMemberAlignDecoration::~StructMemberAlignDecoration() = default;
void StructMemberAlignDecoration::to_str(const semantic::Info&,
void StructMemberAlignDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -42,7 +42,7 @@ class StructMemberAlignDecoration
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -28,7 +28,7 @@ StructMemberOffsetDecoration::StructMemberOffsetDecoration(ProgramID program_id,
StructMemberOffsetDecoration::~StructMemberOffsetDecoration() = default;
void StructMemberOffsetDecoration::to_str(const semantic::Info&,
void StructMemberOffsetDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -49,7 +49,7 @@ class StructMemberOffsetDecoration
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -29,7 +29,7 @@ StructMemberSizeDecoration::StructMemberSizeDecoration(ProgramID program_id,
StructMemberSizeDecoration::~StructMemberSizeDecoration() = default;
void StructMemberSizeDecoration::to_str(const semantic::Info&,
void StructMemberSizeDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -42,7 +42,7 @@ class StructMemberSizeDecoration
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -46,7 +46,7 @@ SwitchStatement* SwitchStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<SwitchStatement>(src, cond, b);
}
void SwitchStatement::to_str(const semantic::Info& sem,
void SwitchStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -55,7 +55,7 @@ class SwitchStatement : public Castable<SwitchStatement, Statement> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -47,7 +47,7 @@ TypeConstructorExpression* TypeConstructorExpression::Clone(
return ctx->dst->create<TypeConstructorExpression>(src, ty, vals);
}
void TypeConstructorExpression::to_str(const semantic::Info& sem,
void TypeConstructorExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -54,7 +54,7 @@ class TypeConstructorExpression
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -29,7 +29,7 @@ UintLiteral::UintLiteral(ProgramID program_id,
UintLiteral::~UintLiteral() = default;
std::string UintLiteral::to_str(const semantic::Info&) const {
std::string UintLiteral::to_str(const sem::Info&) const {
return std::to_string(value()) + "u";
}

View File

@ -44,7 +44,7 @@ class UintLiteral : public Castable<UintLiteral, IntLiteral> {
/// @param sem the semantic info for the program
/// @returns the literal as a string
std::string to_str(const semantic::Info& sem) const override;
std::string to_str(const sem::Info& sem) const override;
/// Clones this node and all transitive child nodes using the `CloneContext`
/// `ctx`.

View File

@ -41,7 +41,7 @@ UnaryOpExpression* UnaryOpExpression::Clone(CloneContext* ctx) const {
return ctx->dst->create<UnaryOpExpression>(src, op_, e);
}
void UnaryOpExpression::to_str(const semantic::Info& sem,
void UnaryOpExpression::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -52,7 +52,7 @@ class UnaryOpExpression : public Castable<UnaryOpExpression, Expression> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -16,7 +16,7 @@
#include "src/ast/constant_id_decoration.h"
#include "src/program_builder.h"
#include "src/semantic/variable.h"
#include "src/sem/variable.h"
TINT_INSTANTIATE_TYPEINFO(tint::ast::Variable);
@ -80,7 +80,7 @@ Variable* Variable::Clone(CloneContext* ctx) const {
is_const_, ctor, decos);
}
void Variable::info_to_str(const semantic::Info& sem,
void Variable::info_to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
auto* var_sem = sem.Get(this);
@ -95,7 +95,7 @@ void Variable::info_to_str(const semantic::Info& sem,
}
}
void Variable::constructor_to_str(const semantic::Info& sem,
void Variable::constructor_to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
if (constructor_ == nullptr)
@ -110,7 +110,7 @@ void Variable::constructor_to_str(const semantic::Info& sem,
out << "}" << std::endl;
}
void Variable::to_str(const semantic::Info& sem,
void Variable::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -150,7 +150,7 @@ class Variable : public Castable<Variable, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;
@ -159,14 +159,14 @@ class Variable : public Castable<Variable, Node> {
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void info_to_str(const semantic::Info& sem,
void info_to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const;
/// Output constructor for this variable.
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void constructor_to_str(const semantic::Info& sem,
void constructor_to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const;

View File

@ -40,7 +40,7 @@ VariableDeclStatement* VariableDeclStatement::Clone(CloneContext* ctx) const {
return ctx->dst->create<VariableDeclStatement>(src, var);
}
void VariableDeclStatement::to_str(const semantic::Info& sem,
void VariableDeclStatement::to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

View File

@ -49,7 +49,7 @@ class VariableDeclStatement
/// @param sem the semantic info for the program
/// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing
void to_str(const semantic::Info& sem,
void to_str(const sem::Info& sem,
std::ostream& out,
size_t indent) const override;

View File

@ -41,7 +41,7 @@ WorkgroupDecoration::WorkgroupDecoration(ProgramID program_id,
WorkgroupDecoration::~WorkgroupDecoration() = default;
void WorkgroupDecoration::to_str(const semantic::Info&,
void WorkgroupDecoration::to_str(const sem::Info&,
std::ostream& out,
size_t indent) const {
make_indent(out, indent);

Some files were not shown because too many files have changed in this diff Show More