mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-21 19:20:07 +00:00
Improve an error message in the assembler (#5219)
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
parent
7c39951f6e
commit
17a26b45ff
@ -544,7 +544,8 @@ spv_result_t spvTextEncodeOpcode(const spvtools::AssemblyGrammar& grammar,
|
|||||||
std::string equal_sign;
|
std::string equal_sign;
|
||||||
error = context->getWord(&equal_sign, &nextPosition);
|
error = context->getWord(&equal_sign, &nextPosition);
|
||||||
if ("=" != equal_sign)
|
if ("=" != equal_sign)
|
||||||
return context->diagnostic() << "'=' expected after result id.";
|
return context->diagnostic() << "'=' expected after result id but found '"
|
||||||
|
<< equal_sign << "'.";
|
||||||
|
|
||||||
// The <opcode> after the '=' sign.
|
// The <opcode> after the '=' sign.
|
||||||
context->setPosition(nextPosition);
|
context->setPosition(nextPosition);
|
||||||
|
@ -41,7 +41,7 @@ TEST_F(OpTypePipeStorageTest, ArgumentCount) {
|
|||||||
Eq(MakeInstruction(spv::Op::OpTypePipeStorage, {1})));
|
Eq(MakeInstruction(spv::Op::OpTypePipeStorage, {1})));
|
||||||
EXPECT_THAT(CompileFailure("%res = OpTypePipeStorage %1 %2 %3 %4 %5",
|
EXPECT_THAT(CompileFailure("%res = OpTypePipeStorage %1 %2 %3 %4 %5",
|
||||||
SPV_ENV_UNIVERSAL_1_1),
|
SPV_ENV_UNIVERSAL_1_1),
|
||||||
Eq("'=' expected after result id."));
|
Eq("'=' expected after result id but found '%2'."));
|
||||||
}
|
}
|
||||||
|
|
||||||
using OpConstantPipeStorageTest = spvtest::TextToBinaryTest;
|
using OpConstantPipeStorageTest = spvtest::TextToBinaryTest;
|
||||||
@ -72,7 +72,7 @@ TEST_F(OpConstantPipeStorageTest, ArgumentCount) {
|
|||||||
Eq(MakeInstruction(spv::Op::OpConstantPipeStorage, {1, 2, 3, 4, 5})));
|
Eq(MakeInstruction(spv::Op::OpConstantPipeStorage, {1, 2, 3, 4, 5})));
|
||||||
EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 3 4 5 %6 %7",
|
EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 3 4 5 %6 %7",
|
||||||
SPV_ENV_UNIVERSAL_1_1),
|
SPV_ENV_UNIVERSAL_1_1),
|
||||||
Eq("'=' expected after result id."));
|
Eq("'=' expected after result id but found '%7'."));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpConstantPipeStorageTest, ArgumentTypes) {
|
TEST_F(OpConstantPipeStorageTest, ArgumentTypes) {
|
||||||
@ -118,7 +118,7 @@ TEST_F(OpCreatePipeFromPipeStorageTest, ArgumentCount) {
|
|||||||
Eq(MakeInstruction(spv::Op::OpCreatePipeFromPipeStorage, {1, 2, 3})));
|
Eq(MakeInstruction(spv::Op::OpCreatePipeFromPipeStorage, {1, 2, 3})));
|
||||||
EXPECT_THAT(CompileFailure("%1 = OpCreatePipeFromPipeStorage %2 %3 %4 %5",
|
EXPECT_THAT(CompileFailure("%1 = OpCreatePipeFromPipeStorage %2 %3 %4 %5",
|
||||||
SPV_ENV_UNIVERSAL_1_1),
|
SPV_ENV_UNIVERSAL_1_1),
|
||||||
Eq("'=' expected after result id."));
|
Eq("'=' expected after result id but found '%5'."));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpCreatePipeFromPipeStorageTest, ArgumentTypes) {
|
TEST_F(OpCreatePipeFromPipeStorageTest, ArgumentTypes) {
|
||||||
|
Loading…
Reference in New Issue
Block a user