Don't omit opaque types for real empty structs in DXIL editing

This commit is contained in:
baldurk
2022-02-15 15:13:36 +00:00
parent d1858f4479
commit da979b23bc
3 changed files with 3 additions and 2 deletions
@@ -754,6 +754,7 @@ Program::Program(const byte *bytes, size_t length)
{
// pretend opaque types are empty structs
m_Types[typeIndex].type = Type::Struct;
m_Types[typeIndex].opaque = true;
typeIndex++;
}
@@ -103,7 +103,7 @@ struct Type
const Type *inner = NULL;
// struct or function
bool packedStruct = false, vararg = false;
bool packedStruct = false, vararg = false, opaque = false;
uint16_t id = 0xFFFF;
rdcstr name;
rdcarray<const Type *> members; // the members for a struct, the parameters for functions
@@ -1020,7 +1020,7 @@ bytebuf ProgramEditor::EncodeProgram() const
}
else if(m_Types[i].type == Type::Struct)
{
if(m_Types[i].members.empty())
if(m_Types[i].opaque)
{
writer.Record(LLVMBC::TypeRecord::OPAQUE);
}