mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-10-18 11:10:05 +00:00
source: Give better message if using new Source Language (#5314)
This commit is contained in:
parent
abcd228d92
commit
7ff331af66
@ -626,7 +626,6 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
|
||||
} break;
|
||||
|
||||
case SPV_OPERAND_TYPE_CAPABILITY:
|
||||
case SPV_OPERAND_TYPE_SOURCE_LANGUAGE:
|
||||
case SPV_OPERAND_TYPE_EXECUTION_MODEL:
|
||||
case SPV_OPERAND_TYPE_ADDRESSING_MODEL:
|
||||
case SPV_OPERAND_TYPE_MEMORY_MODEL:
|
||||
@ -683,6 +682,21 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
|
||||
spvPushOperandTypes(entry->operandTypes, expected_operands);
|
||||
} break;
|
||||
|
||||
case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: {
|
||||
spv_operand_desc entry;
|
||||
if (grammar_.lookupOperand(type, word, &entry)) {
|
||||
return diagnostic()
|
||||
<< "Invalid " << spvOperandTypeStr(parsed_operand.type)
|
||||
<< " operand: " << word
|
||||
<< ", if you are creating a new source language please use "
|
||||
"value 0 "
|
||||
"(Unknown) and when ready, add your source language to "
|
||||
"SPRIV-Headers";
|
||||
}
|
||||
// Prepare to accept operands to this operand, if needed.
|
||||
spvPushOperandTypes(entry->operandTypes, expected_operands);
|
||||
} break;
|
||||
|
||||
case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE:
|
||||
case SPV_OPERAND_TYPE_FUNCTION_CONTROL:
|
||||
case SPV_OPERAND_TYPE_LOOP_CONTROL:
|
||||
|
@ -1154,7 +1154,10 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
{"%2 = OpSpecConstantOp %1 !1000 %2",
|
||||
"Invalid OpSpecConstantOp opcode: 1000"},
|
||||
{"OpCapability !9999", "Invalid capability operand: 9999"},
|
||||
{"OpSource !9999 100", "Invalid source language operand: 9999"},
|
||||
{"OpSource !9999 100",
|
||||
"Invalid source language operand: 9999, if you are creating a new "
|
||||
"source language please use value 0 (Unknown) and when ready, add "
|
||||
"your source language to SPRIV-Headers"},
|
||||
{"OpEntryPoint !9999", "Invalid execution model operand: 9999"},
|
||||
{"OpMemoryModel !9999", "Invalid addressing model operand: 9999"},
|
||||
{"OpMemoryModel Logical !9999", "Invalid memory model operand: 9999"},
|
||||
|
Loading…
Reference in New Issue
Block a user