Fixup syntax_tree build.
Update the syntax tree build to match the changes to the WGSL writer
interface.
Change-Id: I780f3c68bfab7b61ac1ba1642dbe6db6ade54894
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/144680
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/cmd/main.cc b/src/tint/cmd/main.cc
index 08e6864..b276e19 100644
--- a/src/tint/cmd/main.cc
+++ b/src/tint/cmd/main.cc
@@ -1024,7 +1024,7 @@
if (!result) {
std::cerr << "Failed to dump AST: " << result.Failure() << std::endl;
} else {
- std::cout << result.wgsl << std::endl;
+ std::cout << result->wgsl << std::endl;
}
}
#endif // TINT_BUILD_SYNTAX_TREE_WRITER
diff --git a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc
index 084b231..5468c45 100644
--- a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc
+++ b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc
@@ -80,7 +80,7 @@
SyntaxTreePrinter::~SyntaxTreePrinter() = default;
-void SyntaxTreePrinter::Generate() {
+bool SyntaxTreePrinter::Generate() {
// Generate global declarations in the order they appear in the module.
for (auto* decl : program_->AST().GlobalDeclarations()) {
Switch(
@@ -97,6 +97,8 @@
Line();
}
}
+
+ return true;
}
void SyntaxTreePrinter::EmitDiagnosticControl(const ast::DiagnosticControl& diagnostic) {
diff --git a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h
index 23d06e8..2eb63e8 100644
--- a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h
+++ b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h
@@ -78,7 +78,8 @@
~SyntaxTreePrinter() override;
/// Generates the result data
- void Generate();
+ /// @returns true on success.
+ bool Generate();
/// Handles generating a diagnostic control
/// @param diagnostic the diagnostic control node