chromium/third_party/dawn/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc

// Copyright 2021 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/tint/lang/wgsl/writer/ast_printer/ast_printer.h"

#include <string>

#include "src/tint/lang/core/texel_format.h"
#include "src/tint/lang/wgsl/ast/accessor_expression.h"
#include "src/tint/lang/wgsl/ast/alias.h"
#include "src/tint/lang/wgsl/ast/assignment_statement.h"
#include "src/tint/lang/wgsl/ast/binary_expression.h"
#include "src/tint/lang/wgsl/ast/blend_src_attribute.h"
#include "src/tint/lang/wgsl/ast/bool_literal_expression.h"
#include "src/tint/lang/wgsl/ast/break_if_statement.h"
#include "src/tint/lang/wgsl/ast/break_statement.h"
#include "src/tint/lang/wgsl/ast/call_expression.h"
#include "src/tint/lang/wgsl/ast/call_statement.h"
#include "src/tint/lang/wgsl/ast/color_attribute.h"
#include "src/tint/lang/wgsl/ast/compound_assignment_statement.h"
#include "src/tint/lang/wgsl/ast/const.h"
#include "src/tint/lang/wgsl/ast/continue_statement.h"
#include "src/tint/lang/wgsl/ast/diagnostic_attribute.h"
#include "src/tint/lang/wgsl/ast/diagnostic_rule_name.h"
#include "src/tint/lang/wgsl/ast/discard_statement.h"
#include "src/tint/lang/wgsl/ast/float_literal_expression.h"
#include "src/tint/lang/wgsl/ast/for_loop_statement.h"
#include "src/tint/lang/wgsl/ast/id_attribute.h"
#include "src/tint/lang/wgsl/ast/identifier.h"
#include "src/tint/lang/wgsl/ast/identifier_expression.h"
#include "src/tint/lang/wgsl/ast/if_statement.h"
#include "src/tint/lang/wgsl/ast/increment_decrement_statement.h"
#include "src/tint/lang/wgsl/ast/index_accessor_expression.h"
#include "src/tint/lang/wgsl/ast/input_attachment_index_attribute.h"
#include "src/tint/lang/wgsl/ast/int_literal_expression.h"
#include "src/tint/lang/wgsl/ast/internal_attribute.h"
#include "src/tint/lang/wgsl/ast/interpolate_attribute.h"
#include "src/tint/lang/wgsl/ast/invariant_attribute.h"
#include "src/tint/lang/wgsl/ast/let.h"
#include "src/tint/lang/wgsl/ast/loop_statement.h"
#include "src/tint/lang/wgsl/ast/member_accessor_expression.h"
#include "src/tint/lang/wgsl/ast/module.h"
#include "src/tint/lang/wgsl/ast/must_use_attribute.h"
#include "src/tint/lang/wgsl/ast/override.h"
#include "src/tint/lang/wgsl/ast/phony_expression.h"
#include "src/tint/lang/wgsl/ast/return_statement.h"
#include "src/tint/lang/wgsl/ast/stage_attribute.h"
#include "src/tint/lang/wgsl/ast/stride_attribute.h"
#include "src/tint/lang/wgsl/ast/struct_member_align_attribute.h"
#include "src/tint/lang/wgsl/ast/struct_member_offset_attribute.h"
#include "src/tint/lang/wgsl/ast/struct_member_size_attribute.h"
#include "src/tint/lang/wgsl/ast/switch_statement.h"
#include "src/tint/lang/wgsl/ast/templated_identifier.h"
#include "src/tint/lang/wgsl/ast/unary_op_expression.h"
#include "src/tint/lang/wgsl/ast/var.h"
#include "src/tint/lang/wgsl/ast/variable_decl_statement.h"
#include "src/tint/lang/wgsl/ast/while_statement.h"
#include "src/tint/lang/wgsl/ast/workgroup_attribute.h"
#include "src/tint/lang/wgsl/program/program.h"
#include "src/tint/lang/wgsl/sem/struct.h"
#include "src/tint/lang/wgsl/sem/switch_statement.h"
#include "src/tint/utils/macros/defer.h"
#include "src/tint/utils/macros/scoped_assignment.h"
#include "src/tint/utils/math/math.h"
#include "src/tint/utils/rtti/switch.h"
#include "src/tint/utils/strconv/float_to_string.h"
#include "src/tint/utils/text/string.h"

namespace tint::wgsl::writer {

ASTPrinter::ASTPrinter(const Program& program) :{}

ASTPrinter::~ASTPrinter() = default;

bool ASTPrinter::Generate() {}

void ASTPrinter::EmitDiagnosticControl(StringStream& out,
                                       const ast::DiagnosticControl& diagnostic) {}

void ASTPrinter::EmitEnable(const ast::Enable* enable) {}

void ASTPrinter::EmitRequires(const ast::Requires* req) {}

void ASTPrinter::EmitTypeDecl(const ast::TypeDecl* ty) {}

void ASTPrinter::EmitExpression(StringStream& out, const ast::Expression* expr) {}

void ASTPrinter::EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr) {}

void ASTPrinter::EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr) {}

void ASTPrinter::EmitCall(StringStream& out, const ast::CallExpression* expr) {}

void ASTPrinter::EmitLiteral(StringStream& out, const ast::LiteralExpression* lit) {}

void ASTPrinter::EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr) {}

void ASTPrinter::EmitIdentifier(StringStream& out, const ast::Identifier* ident) {}

void ASTPrinter::EmitFunction(const ast::Function* func) {}

void ASTPrinter::EmitImageFormat(StringStream& out, const core::TexelFormat fmt) {}

void ASTPrinter::EmitStructType(const ast::Struct* str) {}

void ASTPrinter::EmitVariable(StringStream& out, const ast::Variable* v) {}

void ASTPrinter::EmitAttributes(StringStream& out, VectorRef<const ast::Attribute*> attrs) {}

void ASTPrinter::EmitBinary(StringStream& out, const ast::BinaryExpression* expr) {}

void ASTPrinter::EmitBinaryOp(StringStream& out, const core::BinaryOp op) {}

void ASTPrinter::EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr) {}

void ASTPrinter::EmitBlock(const ast::BlockStatement* stmt) {}

void ASTPrinter::EmitBlockHeader(StringStream& out, const ast::BlockStatement* stmt) {}

void ASTPrinter::EmitStatement(const ast::Statement* stmt) {}

void ASTPrinter::EmitStatements(VectorRef<const ast::Statement*> stmts) {}

void ASTPrinter::EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts) {}

void ASTPrinter::EmitAssign(const ast::AssignmentStatement* stmt) {}

void ASTPrinter::EmitBreak(const ast::BreakStatement*) {}

void ASTPrinter::EmitBreakIf(const ast::BreakIfStatement* b) {}

void ASTPrinter::EmitCase(const ast::CaseStatement* stmt) {}

void ASTPrinter::EmitCompoundAssign(const ast::CompoundAssignmentStatement* stmt) {}

void ASTPrinter::EmitContinue(const ast::ContinueStatement*) {}

void ASTPrinter::EmitIf(const ast::IfStatement* stmt) {}

void ASTPrinter::EmitIncrementDecrement(const ast::IncrementDecrementStatement* stmt) {}

void ASTPrinter::EmitDiscard(const ast::DiscardStatement*) {}

void ASTPrinter::EmitLoop(const ast::LoopStatement* stmt) {}

void ASTPrinter::EmitForLoop(const ast::ForLoopStatement* stmt) {}

void ASTPrinter::EmitWhile(const ast::WhileStatement* stmt) {}

void ASTPrinter::EmitReturn(const ast::ReturnStatement* stmt) {}

void ASTPrinter::EmitConstAssert(const ast::ConstAssert* stmt) {}

void ASTPrinter::EmitSwitch(const ast::SwitchStatement* stmt) {}

}  // namespace tint::wgsl::writer