blob: c1fd1f398e4853fb2f6d75fb2180efa64f141ee9 [file] [log] [blame] [edit]
<?xml version="1.0" encoding="utf-8"?>
<!--
/// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="tint::Symbol">
<!-- Requires TINT_SYMBOL_STORE_DEBUG_NAME defined to 1 -->
<DisplayString Optional="true">{debug_name_,sb}</DisplayString>
</Type>
<Type Name="tint::ast::AssignmentStatement">
<DisplayString>{*lhs} = {*rhs};</DisplayString>
<Expand>
<Item Name="lhs">*lhs</Item>
<Item Name="rhs">*rhs</Item>
</Expand>
</Type>
<Type Name="tint::ast::IfStatement">
<DisplayString Condition="else_statements.size() == 0">if ({*condition}) {*body}</DisplayString>
<DisplayString Condition="else_statements.size() == 1">if ({*condition}) {*body} {*else_statements[0]} </DisplayString>
<DisplayString Condition="else_statements.size() == 2">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} </DisplayString>
<DisplayString Condition="else_statements.size() == 3">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} {*else_statements[2]}</DisplayString>
<DisplayString Condition="else_statements.size() > 3">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} {*else_statements[2]} else {else_statements.size()-3} more...</DisplayString>
</Type>
<Type Name="tint::ast::ElseStatement">
<DisplayString Condition="!condition">else {*body}</DisplayString>
<DisplayString Condition="!!condition">else if ({*condition}) {*body}</DisplayString>
</Type>
<Type Name="tint::ast::BlockStatement">
<DisplayString Condition="statements.size() == 1">{{ {*statements[0]} }} </DisplayString>
<DisplayString Condition="statements.size() == 2">{{ {*statements[0]} {*statements[1]} }} </DisplayString>
<DisplayString Condition="statements.size() == 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} }} </DisplayString>
<DisplayString Condition="statements.size() > 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} {statements.size()-3} more... }} </DisplayString>
</Type>
<Type Name="tint::ast::ReturnStatement">
<DisplayString Condition="!value">return;</DisplayString>
<DisplayString Condition="!!value">return {*value};</DisplayString>
</Type>
<Type Name="tint::ast::Function">
<DisplayString Condition="params.size() == 0">fn {symbol}() -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() == 1">fn {symbol}({*params[0]}) -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() == 2">fn {symbol}({*params[0]} {*params[1]}) -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() == 3">fn {symbol}({*params[0]} {*params[1]} {*params[2]}) -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() > 3">fn {symbol}({*params[0]} {*params[1]} {*params[2]} {params.size()-3} more...) -> {*return_type} {*body}</DisplayString>
</Type>
<Type Name="tint::ast::IdentifierExpression">
<!--the ",sb" specifier removes the double quotes on the displayed string -->
<DisplayString>{symbol}</DisplayString>
<Expand>
<Item Name="symbol">symbol</Item>
</Expand>
</Type>
<Type Name="tint::ast::IndexAccessorExpression">
<DisplayString>{*object}[{*index}]</DisplayString>
<Expand>
<Item Name="object">*object</Item>
<Item Name="index">*index</Item>
</Expand>
</Type>
<Type Name="tint::ast::MemberAccessorExpression">
<DisplayString>{*structure}.{*member}</DisplayString>
<Expand>
<Item Name="structure">*structure</Item>
<Item Name="member">*member</Item>
</Expand>
</Type>
<Type Name="tint::ast::Variable">
<!-- Hack: we can deduce that this variable is a parameter if it's const with a type but no constructor, which is illegal for a let -->
<DisplayString Condition=" is_const &amp; !!type &amp; !constructor">{symbol} : {*type}</DisplayString>
<DisplayString Condition=" is_const &amp; !!type &amp; !!constructor">let {symbol} : {*type} = {*constructor}</DisplayString>
<DisplayString Condition=" is_const &amp; !type &amp; !constructor">let {symbol} = {*constructor}</DisplayString>
<DisplayString Condition="!is_const &amp; !!type &amp; !!constructor">var {symbol} : {*type} = {*constructor}</DisplayString>
<DisplayString Condition="!is_const &amp; !type &amp; !!constructor">var {symbol} = {*constructor}</DisplayString>
<DisplayString Condition="!is_const &amp; !!type &amp; !constructor">var {symbol}</DisplayString>
</Type>
<Type Name="tint::ast::VariableDeclStatement">
<DisplayString>{*variable};</DisplayString>
</Type>
<Type Name="tint::ast::UintLiteralExpression">
<DisplayString>{value}</DisplayString>
</Type>
<Type Name="tint::ast::SintLiteralExpression">
<DisplayString>{value}</DisplayString>
</Type>
<Type Name="tint::ast::BoolLiteralExpression">
<DisplayString>{value}</DisplayString>
</Type>
<Type Name="tint::ast::Void">
<DisplayString>void</DisplayString>
</Type>
<Type Name="tint::ast::UnaryOpExpression">
<DisplayString Condition="op==tint::ast::UnaryOp::kAddressOf">&amp;({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kComplement">~({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kIndirection">*({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kNegation">-({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kNot">!({expr})</DisplayString>
</Type>
<Type Name="tint::ast::BinaryExpression">
<DisplayString Condition="op==tint::ast::BinaryOp::kNone">({*lhs} NONE {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kAnd">({*lhs} &amp; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kOr">({*lhs} | {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kXor">({*lhs} ^ {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLogicalAnd">({*lhs} &amp;&amp; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLogicalOr">({*lhs} || {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kEqual">({*lhs} == {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kNotEqual">({*lhs} != {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThan">({*lhs} &lt; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThan">({*lhs} &gt; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThanEqual">({*lhs} &lt;= {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThanEqual">({*lhs} &gt;= {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kShiftLeft">({*lhs} &lt;&lt; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kShiftRight">({*lhs} >> {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kAdd">({*lhs} + {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kSubtract">({*lhs} - {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kMultiply">({*lhs} * {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kDivide">({*lhs} / {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kModulo">({*lhs} % {*rhs})</DisplayString>
</Type>
<Type Name="tint::ast::CallExpression">
<DisplayString Condition="args.size() == 0">{target}()</DisplayString>
<DisplayString Condition="args.size() == 1">{target}({*args[0]})</DisplayString>
<DisplayString Condition="args.size() == 2">{target}({*args[0]}, {*args[1]})</DisplayString>
<DisplayString Condition="args.size() == 3">{target}({*args[0]}, {*args[1]}, {*args[2]})</DisplayString>
<DisplayString Condition="args.size() > 3">{target}({*args[0]}, {*args[1]}, {*args[2]}, {args.size()-3} more...)</DisplayString>
<!-- TODO: add more overloads -->
</Type>
<Type Name="tint::ast::CallExpression::Target">
<DisplayString Condition ="name != nullptr">{*name}</DisplayString>
<DisplayString Condition ="name == nullptr">{*type}</DisplayString>
</Type>
<Type Name="tint::ast::Array">
<DisplayString Condition="count != nullptr">array&lt;{*type},{*count}&gt;</DisplayString>
<DisplayString Condition="count == nullptr">array&lt;{*type}&gt;</DisplayString>
</Type>
<Type Name="tint::ast::TypeName">
<DisplayString>{name}</DisplayString>
</Type>
<Type Name="tint::ast::Bool">
<DisplayString>bool</DisplayString>
</Type>
<Type Name="tint::ast::I32">
<DisplayString>i32</DisplayString>
</Type>
<Type Name="tint::ast::U32">
<DisplayString>u32</DisplayString>
</Type>
<Type Name="tint::ast::F32">
<DisplayString>f32</DisplayString>
</Type>
</AutoVisualizer>