[ast] Add helpers for searching a decoration list

This is a commonly used pattern.

Change-Id: I698397c93c33db64c53cbe8662186e1976075b80
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47280
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-04-08 21:53:27 +00:00
committed by Commit Bot service account
parent c76ec15b45
commit a12ccb20a0
14 changed files with 69 additions and 108 deletions

View File

@@ -310,7 +310,8 @@ bool Resolver::ValidateFunction(const ast::Function* func) {
func->source());
return false;
}
} else if (!func->find_decoration<ast::InternalDecoration>()) {
} else if (!ast::HasDecoration<ast::InternalDecoration>(
func->decorations())) {
TINT_ICE(diagnostics_)
<< "Function " << builder_->Symbols().NameFor(func->symbol())
<< " has no body and does not have the [[internal]] decoration";