blob: 87761028e366575bc2d75cdb6d7ba2b497ada9b2 [file] [log] [blame]
Ben Clayton1a567782022-10-14 13:38:27 +00001// Copyright 2022 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_
16#define SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_
17
dan sinclaire4039c72023-02-17 21:58:59 +000018#include "src/tint/builtin/extension.h"
Ben Clayton1a567782022-10-14 13:38:27 +000019#include "src/tint/utils/vector.h"
20
21namespace tint::ast {
22class Module;
23} // namespace tint::ast
24namespace tint::diag {
25class List;
26} // namespace tint::diag
27
28namespace tint::writer {
29
30/// Checks that all the extensions enabled in @p module are found in @p supported, raising an error
31/// diagnostic if an enabled extension is not supported.
32/// @param writer_name the name of the writer making this call
33/// @param module the AST module
34/// @param diags the diagnostics to append an error to, if needed.
35/// @returns true if all extensions in use are supported, otherwise returns false.
36bool CheckSupportedExtensions(std::string_view writer_name,
37 const ast::Module& module,
38 diag::List& diags,
dan sinclaire4039c72023-02-17 21:58:59 +000039 utils::VectorRef<builtin::Extension> supported);
Ben Clayton1a567782022-10-14 13:38:27 +000040
41} // namespace tint::writer
42
43#endif // SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_