This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Emit UdtSourceLine information for enums
ClosedPublic

Authored by asmith on Mar 5 2018, 1:15 PM.

Details

Summary
  • Emit UdtSourceLine information for enums to match MSVC
  • Add a method to add UDTSrcLine and call it for all Class/Struct/Union/Enum
  • Update test cases to verify the changes

Diff Detail

Event Timeline

asmith created this revision.Mar 5 2018, 1:15 PM
asmith added a reviewer: rnk.
rnk added a comment.Mar 5 2018, 1:24 PM

We also probably need to emit S_UDT symbol records in the right place. Can you factor out a method with this code from lowerCompleteTypeClass and make Class, Enum, and Union code call it? This is the duplicated code that has already diverged a little bit:

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);
}

addToUDTs(Ty);
asmith updated this revision to Diff 137111.Mar 5 2018, 5:57 PM
asmith edited the summary of this revision. (Show Details)
rnk accepted this revision.Mar 6 2018, 9:59 AM

lgtm

lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
1791

We should call addToUDTs(Ty) here as a followup. MSVC emits S_UDT records for enums as well as typedefs, structs, etc.

This revision is now accepted and ready to land.Mar 6 2018, 9:59 AM
This revision was automatically updated to reflect the committed changes.