| 952 | } |
| 953 | |
| 954 | spv_result_t spvBinaryParseWithOptions( |
| 955 | const spv_const_context context, void* user_data, const uint32_t* code, |
| 956 | const size_t num_words, spv_parsed_header_fn_t parsed_header, |
| 957 | spv_parsed_instruction_fn_t parsed_instruction, spv_diagnostic* diagnostic, |
| 958 | uint32_t options) { |
| 959 | spv_context_t hijack_context = *context; |
| 960 | if (diagnostic) { |
| 961 | *diagnostic = nullptr; |
| 962 | spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, diagnostic); |
| 963 | } |
| 964 | Parser parser(&hijack_context, user_data, parsed_header, parsed_instruction); |
| 965 | if (options & SPV_BINARY_TO_TEXT_OPTION_HANDLE_UNKNOWN_OPCODES) { |
| 966 | parser.SetHandleUnknownOpcodes(true); |
| 967 | } |
| 968 | return parser.parse(code, num_words, diagnostic); |
| 969 | } |
| 970 | |
| 971 | // TODO(dneto): This probably belongs in text.cpp since that's the only place |
| 972 | // that a spv_binary_t value is created. |