Ben Clayton | 1a56778 | 2022-10-14 13:38:27 +0000 | [diff] [blame] | 1 | // 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 sinclair | e4039c7 | 2023-02-17 21:58:59 +0000 | [diff] [blame] | 18 | #include "src/tint/builtin/extension.h" |
Ben Clayton | 1a56778 | 2022-10-14 13:38:27 +0000 | [diff] [blame] | 19 | #include "src/tint/utils/vector.h" |
| 20 | |
| 21 | namespace tint::ast { |
| 22 | class Module; |
| 23 | } // namespace tint::ast |
| 24 | namespace tint::diag { |
| 25 | class List; |
| 26 | } // namespace tint::diag |
| 27 | |
| 28 | namespace 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. |
| 36 | bool CheckSupportedExtensions(std::string_view writer_name, |
| 37 | const ast::Module& module, |
| 38 | diag::List& diags, |
dan sinclair | e4039c7 | 2023-02-17 21:58:59 +0000 | [diff] [blame] | 39 | utils::VectorRef<builtin::Extension> supported); |
Ben Clayton | 1a56778 | 2022-10-14 13:38:27 +0000 | [diff] [blame] | 40 | |
| 41 | } // namespace tint::writer |
| 42 | |
| 43 | #endif // SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_ |