| 28 | namespace { |
| 29 | |
| 30 | bool Validate(const std::vector<uint32_t>& bin) { |
| 31 | spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; |
| 32 | spv_context spvContext = spvContextCreate(target_env); |
| 33 | spv_diagnostic diagnostic = nullptr; |
| 34 | spv_const_binary_t binary = {bin.data(), bin.size()}; |
| 35 | spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); |
| 36 | if (error != 0) spvDiagnosticPrint(diagnostic); |
| 37 | spvDiagnosticDestroy(diagnostic); |
| 38 | spvContextDestroy(spvContext); |
| 39 | return error == 0; |
| 40 | } |
| 41 | |
| 42 | void Match(const std::string& original, IRContext* context, |
| 43 | bool do_validation = true) { |
no test coverage detected