mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Add ast::InternalDecoration
An tint-internal decoration used to add metadata between a sanitizer transform and a backend. Will be used for declaring backend-specific intrinsic calls. Change-Id: Ia05ba7dada0148de2d490605ba4d15c593075356 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46868 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
86c2cbfb7e
commit
b502fdf82b
@@ -26,6 +26,7 @@
|
||||
#include "src/ast/discard_statement.h"
|
||||
#include "src/ast/fallthrough_statement.h"
|
||||
#include "src/ast/if_statement.h"
|
||||
#include "src/ast/internal_decoration.h"
|
||||
#include "src/ast/loop_statement.h"
|
||||
#include "src/ast/return_statement.h"
|
||||
#include "src/ast/struct_block_decoration.h"
|
||||
@@ -301,12 +302,18 @@ bool Resolver::ValidateFunction(const ast::Function* func) {
|
||||
}
|
||||
|
||||
if (!func->return_type()->Is<type::Void>()) {
|
||||
if (!func->get_last_statement() ||
|
||||
!func->get_last_statement()->Is<ast::ReturnStatement>()) {
|
||||
diagnostics_.add_error(
|
||||
"v-0002", "non-void function must end with a return statement",
|
||||
func->source());
|
||||
return false;
|
||||
if (func->body()) {
|
||||
if (!func->get_last_statement() ||
|
||||
!func->get_last_statement()->Is<ast::ReturnStatement>()) {
|
||||
diagnostics_.add_error(
|
||||
"v-0002", "non-void function must end with a return statement",
|
||||
func->source());
|
||||
return false;
|
||||
}
|
||||
} else if (!func->find_decoration<ast::InternalDecoration>()) {
|
||||
TINT_ICE(diagnostics_)
|
||||
<< "Function " << builder_->Symbols().NameFor(func->symbol())
|
||||
<< " has no body and does not have the [[internal]] decoration";
|
||||
}
|
||||
|
||||
for (auto* deco : func->return_type_decorations()) {
|
||||
@@ -594,8 +601,10 @@ bool Resolver::Function(ast::Function* func) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!BlockStatement(func->body())) {
|
||||
return false;
|
||||
if (func->body()) {
|
||||
if (!BlockStatement(func->body())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
variable_stack_.pop_scope();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user