mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-12-24 00:40:14 +00:00
OpUndef can appear in type declaration section
This commit is contained in:
parent
94912ad1ba
commit
b01755a5e2
@ -122,6 +122,7 @@ bool IsInstructionInLayoutSection(ModuleLayoutSection layout, SpvOp op) {
|
||||
case SpvOpVariable:
|
||||
case SpvOpLine:
|
||||
case SpvOpNoLine:
|
||||
case SpvOpUndef:
|
||||
out = true;
|
||||
break;
|
||||
default: break;
|
||||
|
@ -313,7 +313,7 @@ TEST_F(ValidateLayout, FuncParameterNotImmediatlyAfterFuncBad) {
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateLayout, InstructionAppearBeforeFunctionDefinition) {
|
||||
TEST_F(ValidateLayout, OpUndefCanAppearInTypeDeclarationSection) {
|
||||
string str = R"(
|
||||
OpCapability Kernel
|
||||
OpMemoryModel Logical OpenCL
|
||||
@ -328,8 +328,25 @@ TEST_F(ValidateLayout, InstructionAppearBeforeFunctionDefinition) {
|
||||
)";
|
||||
|
||||
CompileSuccessfully(str);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(), StrEq("Undef must appear in a block"));
|
||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateLayout, OpUndefCanAppearInBlock) {
|
||||
string str = R"(
|
||||
OpCapability Kernel
|
||||
OpMemoryModel Logical OpenCL
|
||||
%voidt = OpTypeVoid
|
||||
%uintt = OpTypeInt 32 0
|
||||
%funct = OpTypeFunction %voidt
|
||||
%func = OpFunction %voidt None %funct
|
||||
%entry = OpLabel
|
||||
%udef = OpUndef %uintt
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
|
||||
CompileSuccessfully(str);
|
||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateLayout, MissingFunctionEndForFunctionWithBody) {
|
||||
|
Loading…
Reference in New Issue
Block a user