return CO;
}
+void CodeViewDebug::addUDTSrcLine(const DIType *Ty, TypeIndex TI) {
+ switch (Ty->getTag()) {
+ case dwarf::DW_TAG_class_type:
+ case dwarf::DW_TAG_structure_type:
+ case dwarf::DW_TAG_union_type:
+ case dwarf::DW_TAG_enumeration_type:
+ break;
+ default:
+ return;
+ }
+
+ if (const auto *File = Ty->getFile()) {
+ StringIdRecord SIDR(TypeIndex(0x0), getFullFilepath(File));
+ TypeIndex SIDI = TypeTable.writeLeafType(SIDR);
+
+ UdtSourceLineRecord USLR(TI, SIDI, Ty->getLine());
+ TypeTable.writeLeafType(USLR);
+ }
+}
+
TypeIndex CodeViewDebug::lowerTypeEnum(const DICompositeType *Ty) {
ClassOptions CO = getCommonClassOptions(Ty);
TypeIndex FTI;
EnumRecord ER(EnumeratorCount, CO, FTI, FullName, Ty->getIdentifier(),
getTypeIndex(Ty->getBaseType()));
- return TypeTable.writeLeafType(ER);
+ TypeIndex EnumTI = TypeTable.writeLeafType(ER);
+
+ addUDTSrcLine(Ty, EnumTI);
+
+ return EnumTI;
}
//===----------------------------------------------------------------------===//
SizeInBytes, FullName, Ty->getIdentifier());
TypeIndex ClassTI = TypeTable.writeLeafType(CR);
- if (const auto *File = Ty->getFile()) {
- StringIdRecord SIDR(TypeIndex(0x0), getFullFilepath(File));
- TypeIndex SIDI = TypeTable.writeLeafType(SIDR);
-
- UdtSourceLineRecord USLR(ClassTI, SIDI, Ty->getLine());
- TypeTable.writeLeafType(USLR);
- }
+ addUDTSrcLine(Ty, ClassTI);
addToUDTs(Ty);
Ty->getIdentifier());
TypeIndex UnionTI = TypeTable.writeLeafType(UR);
- StringIdRecord SIR(TypeIndex(0x0), getFullFilepath(Ty->getFile()));
- TypeIndex SIRI = TypeTable.writeLeafType(SIR);
-
- UdtSourceLineRecord USLR(UnionTI, SIRI, Ty->getLine());
- TypeTable.writeLeafType(USLR);
+ addUDTSrcLine(Ty, UnionTI);
addToUDTs(Ty);
; CHECK-NEXT: FieldListType: <field list> (0x1000)
; CHECK-NEXT: Name: E
; CHECK-NEXT: }
+; CHECK-NEXT: StringId (0x1002) {
+; CHECK-NEXT: TypeLeafKind: LF_STRING_ID (0x1605)
+; CHECK-NEXT: Id: 0x0
+; CHECK-NEXT: StringData: \<stdin>
+; CHECK-NEXT: }
+; CHECK-NEXT: UdtSourceLine (0x1003) {
+; CHECK-NEXT: TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
+; CHECK-NEXT: UDT: E (0x1001)
+; CHECK-NEXT: SourceFile: \<stdin> (0x1002)
+; CHECK-NEXT: LineNumber: 1
+; CHECK_NEXT }
source_filename = "test/DebugInfo/COFF/enum.ll"
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"