LFUDTMODSRCLINE (0x1607) - UDT Source Line in Module

December 12, 2025 ยท View on GitHub

Specifies the source location for the definition of a user-defined type (UDT). This record is the same as LF_MOD_SRC_LINE except that it adds a module_index field.

struct UdtModSrcLine {
    TypeIndex type;
    NameIndex file_name;
    uint32_t line;
    uint16_t module_index;
};

Source code comments in cvinfo.h imply that this record is generated by the linker, not the compiler.

type is the type being described.

file_name points into the Names Stream and specifies the file name.

line is the 1-based line number of the definition of the UDT.

module_index is the module index of a module which defined this type.

TODO: There's a big problem here! What is the proper value for module_index if a type was defined in more than one module? It is expected that most types are defined in more than one module. If the linker collects LF_UDT_SRC_LINE records from different modules that point to the same TypeIndex, which one does it pick? The choice is likely non-deterministic.

For determinism, should we squash module_index and set it to some fixed value? What actually reads module_index?

Determinism: It is assumed that this is the index of the module which defined this UDT. However, there is a problem: What if the same UDT is defined in more than one module? It is not clear if there is a deterministic result. Because that information (the set of modules which defined the same UDT) is not present in the linker, we cannot replace the module index with a deterministic selection from that set. Instead, we can only set the module index to some well-known value, like 0.