[PATCH] D55239: [codeview] Emit typedefs of types derived from incomplete types

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 08:41:14 PST 2018


aganea added a comment.

I just wanted to point out that this overall process of dropping UDT records is not the behavior that MSVC exhibits. S_UDTs are (should be) stripped by the linker, not by the compiler. It's also the linker's job (in my sense) to remap forward references to full complete types (albeit if you can it locally in the compiler, it is probably better).

  > cl udts-fwd.cpp /c /Z7
  > cvdump udts-fwd.obj
  
  *** SYMBOLS
  
  (0000C8) S_GDATA32: [0000:00000000], Type:             0x105C, global_ptr
  (0000E1) S_UDT:             0x105D, TypedefFwdPtr
  (0000F7) S_UDT:             0x105B, TypedefFwd
  
  *** TYPES
  
  0x105b : Length = 34, Leaf = 0x1505 LF_STRUCTURE
  	# members = 0,  field list type 0x0000, FORWARD REF, 
  	Derivation list type 0x0000, VT shape type 0x0000
  	Size = 0, class name = Foo, unique name = .?AUFoo@@
  
  0x105c : Length = 10, Leaf = 0x1002 LF_POINTER
  	Pointer (__ptr64), Size: 8
  	Element type : 0x105B
  
  0x105d : Length = 10, Leaf = 0x1002 LF_POINTER
  	Pointer (__ptr64), Size: 8
  	Element type : 0x105B
  
  > link udts-fwd.obj /debug /entry:ExitProcess kernel32.lib /subsytem:console
  > cvdump udts-fwd.pdb
  
  
  *** TYPES
  
  0x1000 : Length = 34, Leaf = 0x1505 LF_STRUCTURE
  	# members = 0,  field list type 0x0000, FORWARD REF, 
  	Derivation list type 0x0000, VT shape type 0x0000
  	Size = 0, class name = Foo, unique name = .?AUFoo@@
  
  0x1001 : Length = 10, Leaf = 0x1002 LF_POINTER
  	Pointer (__ptr64), Size: 8
  	Element type : 0x1000
  
  *** GLOBALS
  
  S_UDT:             0x1001, TypedefFwdPtr
  S_GDATA32: [0003:00000000], Type:             0x1001, global_ptr

Like I was suggesting in D55236 <https://reviews.llvm.org/D55236>, I think this is part of a post-merge step that `link.exe` does, see here <https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/PDB/dbi/mod.cpp#L2286> and here <https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/PDB/dbi/mod.cpp#L2795> (although I haven't looked exactly into detail).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55239/new/

https://reviews.llvm.org/D55239





More information about the llvm-commits mailing list