| 467 | } |
| 468 | |
| 469 | spv_result_t spvValidateBinary(const spv_const_context context, |
| 470 | const uint32_t* words, const size_t num_words, |
| 471 | spv_diagnostic* pDiagnostic) { |
| 472 | spv_context_t hijack_context = *context; |
| 473 | if (pDiagnostic) { |
| 474 | *pDiagnostic = nullptr; |
| 475 | spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, pDiagnostic); |
| 476 | } |
| 477 | |
| 478 | // This interface is used for default command line options. |
| 479 | spv_validator_options default_options = spvValidatorOptionsCreate(); |
| 480 | |
| 481 | // Create the ValidationState using the context and default options. |
| 482 | spvtools::val::ValidationState_t vstate(&hijack_context, default_options, |
| 483 | words, num_words, |
| 484 | kDefaultMaxNumOfWarnings); |
| 485 | |
| 486 | spv_result_t result = |
| 487 | spvtools::val::ValidateBinaryUsingContextAndValidationState( |
| 488 | hijack_context, words, num_words, pDiagnostic, &vstate); |
| 489 | |
| 490 | spvValidatorOptionsDestroy(default_options); |
| 491 | return result; |
| 492 | } |
| 493 | |
| 494 | spv_result_t spvValidateWithOptions(const spv_const_context context, |
| 495 | spv_const_validator_options options, |
no test coverage detected