[llvm] r279089 - Resubmit "Write the TPI stream from a PDB to Yaml."

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 07:36:13 PDT 2016


Probably, I will take a look in a little bit.

On Tue, Aug 23, 2016 at 1:45 AM Simon Pilgrim <llvm-dev at redking.me.uk>
wrote:

> Hi Zachary,
>
> Would it be possible to remove
> llvm/trunk/lib/DebugInfo/CodeView/TypeDeserializer.cpp now that its appears
> to be unused?
>
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/10411/steps/build/logs/warnings%20%281%29
>
>
> Simon.
>
> On 18 Aug 2016, at 17:49, Zachary Turner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> Author: zturner
> Date: Thu Aug 18 11:49:29 2016
> New Revision: 279089
>
> URL: http://llvm.org/viewvc/llvm-project?rev=279089&view=rev
> Log:
> Resubmit "Write the TPI stream from a PDB to Yaml."
>
> The original patch was breaking some buildbots due to an
> incorrect ordering of function definitions which caused some
> compilers to recognize a definition but others to not.
>
> Added:
>    llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test
>    llvm/trunk/tools/llvm-pdbdump/CodeViewYaml.cpp
>    llvm/trunk/tools/llvm-pdbdump/CodeViewYaml.h
> Modified:
>    llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
>    llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h
>    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
>    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h
>    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
>    llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h
>    llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
>    llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp
>    llvm/trunk/lib/DebugInfo/CodeView/TypeDeserializer.cpp
>    llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
>    llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp
>    llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
>    llvm/trunk/test/DebugInfo/COFF/big-type.ll
>    llvm/trunk/test/DebugInfo/COFF/enum.ll
>    llvm/trunk/test/DebugInfo/COFF/inheritance.ll
>    llvm/trunk/test/DebugInfo/COFF/virtual-method-kinds.ll
>    llvm/trunk/test/DebugInfo/COFF/virtual-methods.ll
>    llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
>    llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt
>    llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp
>    llvm/trunk/tools/llvm-pdbdump/PdbYaml.h
>    llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.cpp
>    llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.h
>    llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
>    llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.h
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h Thu Aug 18
> 11:49:29 2016
> @@ -28,6 +28,8 @@ public:
>   /// Visits the type records in Data. Sets the error flag on parse
> failures.
>   Error visitTypeStream(const CVTypeArray &Types);
>
> +  Error visitFieldListMemberStream(ArrayRef<uint8_t> FieldList);
> +
> private:
>   /// The interface to the class that gets notified of each visitation.
>   TypeVisitorCallbacks &Callbacks;
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h Thu Aug 18
> 11:49:29 2016
> @@ -20,6 +20,7 @@
> namespace llvm {
> namespace codeview {
> ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
> +ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();
> ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
> ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames();
> ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames();
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDeserializer.h?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDeserializer.h Thu Aug
> 18 11:49:29 2016
> @@ -15,9 +15,9 @@
>
> namespace llvm {
> namespace codeview {
> -class TypeDeserializerBase : public TypeVisitorCallbacks {
> +class TypeDeserializer : public TypeVisitorCallbacks {
> public:
> -  explicit TypeDeserializerBase(TypeVisitorCallbacks &Recipient)
> +  explicit TypeDeserializer(TypeVisitorCallbacks &Recipient)
>       : Recipient(Recipient) {}
>
>   Error visitTypeBegin(const CVRecord<TypeLeafKind> &Record) override {
> @@ -62,39 +62,6 @@ private:
>     return Recipient.visitKnownRecord(CVR, Record);
>   }
> };
> -
> -class TypeDeserializer : public TypeDeserializerBase {
> -public:
> -  explicit TypeDeserializer(TypeVisitorCallbacks &Recipient)
> -      : TypeDeserializerBase(Recipient) {}
> -
> -  /// FieldList records need special handling.  For starters, they do not
> -  /// describe their own length, so a different extraction algorithm is
> -  /// necessary.  Secondly, a single FieldList record will result in the
> -  /// deserialization of many records.  So even though the top level
> visitor
> -  /// calls visitFieldBegin() on a single record, multiple records get
> visited
> -  /// through the callback interface.
> -  Error visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
> -                         FieldListRecord &Record) override;
> -
> -private:
> -  template <typename T>
> -  Error visitKnownMember(ArrayRef<uint8_t> &Data, TypeLeafKind Kind,
> -                         T &Record) {
> -    ArrayRef<uint8_t> OldData = Data;
> -    if (auto EC = deserializeRecord(Data, Kind, Record))
> -      return EC;
> -    assert(Data.size() < OldData.size());
> -
> -    CVRecord<TypeLeafKind> CVR;
> -    CVR.Length = OldData.size() - Data.size();
> -    CVR.Data = OldData.slice(0, CVR.Length);
> -    CVR.RawData = CVR.Data;
> -    return Recipient.visitKnownRecord(CVR, Record);
> -  }
> -
> -  Error skipPadding(ArrayRef<uint8_t> &Data);
> -};
> }
> }
>
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h Thu Aug 18
> 11:49:29 2016
> @@ -87,6 +87,7 @@ private:
>
>   ScopedPrinter *W;
>
> +  bool IsInFieldList = false;
>   bool PrintRecordBytes = false;
>
>   /// Name of the current type. Only valid before visitTypeEnd.
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h Thu Aug 18
> 11:49:29 2016
> @@ -12,6 +12,7 @@
>
> #include "llvm/ADT/APSInt.h"
> #include "llvm/ADT/ArrayRef.h"
> +#include "llvm/ADT/Optional.h"
> #include "llvm/ADT/StringRef.h"
> #include "llvm/DebugInfo/CodeView/CVRecord.h"
> #include "llvm/DebugInfo/CodeView/CodeView.h"
> @@ -27,6 +28,9 @@ using llvm::support::little32_t;
> using llvm::support::ulittle16_t;
> using llvm::support::ulittle32_t;
>
> +typedef CVRecord<TypeLeafKind> CVType;
> +typedef msf::VarStreamArray<CVType> CVTypeArray;
> +
> /// Equvalent to CV_fldattr_t in cvinfo.h.
> struct MemberAttributes {
>   ulittle16_t Attrs;
> @@ -90,18 +94,19 @@ public:
>     return Representation;
>   }
>
> +  TypeIndex ContainingType;
> +  PointerToMemberRepresentation Representation;
> +
> private:
>   struct Layout {
>     TypeIndex ClassType;
>     ulittle16_t Representation; // PointerToMemberRepresentation
>   };
> -
> -  TypeIndex ContainingType;
> -  PointerToMemberRepresentation Representation;
> };
>
> class TypeRecord {
> protected:
> +  TypeRecord() {}
>   explicit TypeRecord(TypeRecordKind Kind) : Kind(Kind) {}
>
> public:
> @@ -129,14 +134,14 @@ public:
>   TypeIndex getModifiedType() const { return ModifiedType; }
>   ModifierOptions getModifiers() const { return Modifiers; }
>
> +  TypeIndex ModifiedType;
> +  ModifierOptions Modifiers;
> +
> private:
>   struct Layout {
>     TypeIndex ModifiedType;
>     ulittle16_t Modifiers; // ModifierOptions
>   };
> -
> -  TypeIndex ModifiedType;
> -  ModifierOptions Modifiers;
> };
>
> // LF_PROCEDURE
> @@ -165,6 +170,12 @@ public:
>   uint16_t getParameterCount() const { return ParameterCount; }
>   TypeIndex getArgumentList() const { return ArgumentList; }
>
> +  TypeIndex ReturnType;
> +  CallingConvention CallConv;
> +  FunctionOptions Options;
> +  uint16_t ParameterCount;
> +  TypeIndex ArgumentList;
> +
> private:
>   struct Layout {
>     TypeIndex ReturnType;
> @@ -173,12 +184,6 @@ private:
>     ulittle16_t NumParameters;
>     TypeIndex ArgListType;
>   };
> -
> -  TypeIndex ReturnType;
> -  CallingConvention CallConv;
> -  FunctionOptions Options;
> -  uint16_t ParameterCount;
> -  TypeIndex ArgumentList;
> };
>
> // LF_MFUNCTION
> @@ -212,6 +217,15 @@ public:
>   TypeIndex getArgumentList() const { return ArgumentList; }
>   int32_t getThisPointerAdjustment() const { return ThisPointerAdjustment;
> }
>
> +  TypeIndex ReturnType;
> +  TypeIndex ClassType;
> +  TypeIndex ThisType;
> +  CallingConvention CallConv;
> +  FunctionOptions Options;
> +  uint16_t ParameterCount;
> +  TypeIndex ArgumentList;
> +  int32_t ThisPointerAdjustment;
> +
> private:
>   struct Layout {
>     TypeIndex ReturnType;
> @@ -223,15 +237,6 @@ private:
>     TypeIndex ArgListType;
>     little32_t ThisAdjustment;
>   };
> -
> -  TypeIndex ReturnType;
> -  TypeIndex ClassType;
> -  TypeIndex ThisType;
> -  CallingConvention CallConv;
> -  FunctionOptions Options;
> -  uint16_t ParameterCount;
> -  TypeIndex ArgumentList;
> -  int32_t ThisPointerAdjustment;
> };
>
> // LF_MFUNC_ID
> @@ -252,6 +257,9 @@ public:
>   TypeIndex getClassType() const { return ClassType; }
>   TypeIndex getFunctionType() const { return FunctionType; }
>   StringRef getName() const { return Name; }
> +  TypeIndex ClassType;
> +  TypeIndex FunctionType;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -259,9 +267,6 @@ private:
>     TypeIndex FunctionType;
>     // Name: The null-terminated name follows.
>   };
> -  TypeIndex ClassType;
> -  TypeIndex FunctionType;
> -  StringRef Name;
> };
>
> // LF_ARGLIST, LF_SUBSTR_LIST
> @@ -283,13 +288,13 @@ public:
>
>   static uint32_t getLayoutSize() { return 2 + sizeof(Layout); }
>
> +  std::vector<TypeIndex> StringIndices;
> +
> private:
>   struct Layout {
>     ulittle32_t NumArgs; // Number of arguments
>                          // ArgTypes[]: Type indicies of arguments
>   };
> -
> -  std::vector<TypeIndex> StringIndices;
> };
>
> // LF_POINTER
> @@ -308,8 +313,8 @@ public:
>
>   PointerRecord(TypeIndex ReferentType, PointerKind Kind, PointerMode Mode,
>                 PointerOptions Options, uint8_t Size)
> -      : PointerRecord(ReferentType, Kind, Mode, Options, Size,
> -                      MemberPointerInfo()) {}
> +      : TypeRecord(TypeRecordKind::Pointer), ReferentType(ReferentType),
> +        PtrKind(Kind), Mode(Mode), Options(Options), Size(Size) {}
>
>   PointerRecord(TypeIndex ReferentType, PointerKind Kind, PointerMode Mode,
>                 PointerOptions Options, uint8_t Size,
> @@ -330,7 +335,7 @@ public:
>   PointerMode getMode() const { return Mode; }
>   PointerOptions getOptions() const { return Options; }
>   uint8_t getSize() const { return Size; }
> -  MemberPointerInfo getMemberInfo() const { return MemberInfo; }
> +  MemberPointerInfo getMemberInfo() const { return *MemberInfo; }
>
>   bool isPointerToMember() const {
>     return Mode == PointerMode::PointerToDataMember ||
> @@ -349,6 +354,13 @@ public:
>     return !!(uint32_t(Options) & uint32_t(PointerOptions::Unaligned));
>   }
>
> +  TypeIndex ReferentType;
> +  PointerKind PtrKind;
> +  PointerMode Mode;
> +  PointerOptions Options;
> +  uint8_t Size;
> +  Optional<MemberPointerInfo> MemberInfo;
> +
> private:
>   struct Layout {
>     TypeIndex PointeeType;
> @@ -379,13 +391,6 @@ private:
>       return isPointerToMemberFunction() || isPointerToDataMember();
>     }
>   };
> -
> -  TypeIndex ReferentType;
> -  PointerKind PtrKind;
> -  PointerMode Mode;
> -  PointerOptions Options;
> -  uint8_t Size;
> -  MemberPointerInfo MemberInfo;
> };
>
> // LF_NESTTYPE
> @@ -405,23 +410,23 @@ public:
>   TypeIndex getNestedType() const { return Type; }
>   StringRef getName() const { return Name; }
>
> +  TypeIndex Type;
> +  StringRef Name;
> +
> private:
>   struct Layout {
>     ulittle16_t Pad0; // Should be zero
>     TypeIndex Type;   // Type index of nested type
>                       // Name: Null-terminated string
>   };
> -
> -  TypeIndex Type;
> -  StringRef Name;
> };
>
> // LF_FIELDLIST
> class FieldListRecord : public TypeRecord {
> public:
>   explicit FieldListRecord(TypeRecordKind Kind) : TypeRecord(Kind) {}
> -  FieldListRecord(ArrayRef<uint8_t> ListData)
> -      : TypeRecord(TypeRecordKind::FieldList), ListData(ListData) {}
> +  explicit FieldListRecord(ArrayRef<uint8_t> Data)
> +      : TypeRecord(TypeRecordKind::FieldList), Data(Data) {}
>
>   /// Rewrite member type indices with IndexMap. Returns false if a type
> index
>   /// is not in the map.
> @@ -430,10 +435,7 @@ public:
>   static Expected<FieldListRecord> deserialize(TypeRecordKind Kind,
>                                                ArrayRef<uint8_t> &Data);
>
> -  ArrayRef<uint8_t> getFieldListData() const { return ListData; }
> -
> -private:
> -  ArrayRef<uint8_t> ListData;
> +  ArrayRef<uint8_t> Data;
> };
>
> // LF_ARRAY
> @@ -457,6 +459,11 @@ public:
>   uint64_t getSize() const { return Size; }
>   llvm::StringRef getName() const { return Name; }
>
> +  TypeIndex ElementType;
> +  TypeIndex IndexType;
> +  uint64_t Size;
> +  llvm::StringRef Name;
> +
> private:
>   struct Layout {
>     TypeIndex ElementType;
> @@ -464,11 +471,6 @@ private:
>     // SizeOf: LF_NUMERIC encoded size in bytes. Not element count!
>     // Name: The null-terminated name follows.
>   };
> -
> -  TypeIndex ElementType;
> -  TypeIndex IndexType;
> -  uint64_t Size;
> -  llvm::StringRef Name;
> };
>
> class TagRecord : public TypeRecord {
> @@ -495,7 +497,6 @@ public:
>   StringRef getName() const { return Name; }
>   StringRef getUniqueName() const { return UniqueName; }
>
> -private:
>   uint16_t MemberCount;
>   ClassOptions Options;
>   TypeIndex FieldList;
> @@ -528,6 +529,12 @@ public:
>   TypeIndex getVTableShape() const { return VTableShape; }
>   uint64_t getSize() const { return Size; }
>
> +  HfaKind Hfa;
> +  WindowsRTClassKind WinRTKind;
> +  TypeIndex DerivationList;
> +  TypeIndex VTableShape;
> +  uint64_t Size;
> +
> private:
>   struct Layout {
>     ulittle16_t MemberCount; // Number of members in FieldList.
> @@ -543,12 +550,6 @@ private:
>       return Properties & uint16_t(ClassOptions::HasUniqueName);
>     }
>   };
> -
> -  HfaKind Hfa;
> -  WindowsRTClassKind WinRTKind;
> -  TypeIndex DerivationList;
> -  TypeIndex VTableShape;
> -  uint64_t Size;
> };
>
> // LF_UNION
> @@ -567,6 +568,9 @@ struct UnionRecord : public TagRecord {
>   HfaKind getHfa() const { return Hfa; }
>   uint64_t getSize() const { return Size; }
>
> +  HfaKind Hfa;
> +  uint64_t Size;
> +
> private:
>   struct Layout {
>     ulittle16_t MemberCount; // Number of members in FieldList.
> @@ -580,9 +584,6 @@ private:
>       return Properties & uint16_t(ClassOptions::HasUniqueName);
>     }
>   };
> -
> -  HfaKind Hfa;
> -  uint64_t Size;
> };
>
> // LF_ENUM
> @@ -602,6 +603,7 @@ public:
>                                           ArrayRef<uint8_t> &Data);
>
>   TypeIndex getUnderlyingType() const { return UnderlyingType; }
> +  TypeIndex UnderlyingType;
>
> private:
>   struct Layout {
> @@ -616,7 +618,6 @@ private:
>     }
>   };
>
> -  TypeIndex UnderlyingType;
> };
>
> // LF_BITFIELD
> @@ -637,6 +638,9 @@ public:
>   TypeIndex getType() const { return Type; }
>   uint8_t getBitOffset() const { return BitOffset; }
>   uint8_t getBitSize() const { return BitSize; }
> +  TypeIndex Type;
> +  uint8_t BitSize;
> +  uint8_t BitOffset;
>
> private:
>   struct Layout {
> @@ -645,9 +649,6 @@ private:
>     uint8_t BitOffset;
>   };
>
> -  TypeIndex Type;
> -  uint8_t BitSize;
> -  uint8_t BitOffset;
> };
>
> // LF_VTSHAPE
> @@ -672,6 +673,8 @@ public:
>     return Slots;
>   }
>   uint32_t getEntryCount() const { return getSlots().size(); }
> +  ArrayRef<VFTableSlotKind> SlotsRef;
> +  std::vector<VFTableSlotKind> Slots;
>
> private:
>   struct Layout {
> @@ -682,9 +685,6 @@ private:
>     // Descriptors[]: 4-bit virtual method descriptors of type
> CV_VTS_desc_e.
>   };
>
> -private:
> -  ArrayRef<VFTableSlotKind> SlotsRef;
> -  std::vector<VFTableSlotKind> Slots;
> };
>
> // LF_TYPESERVER2
> @@ -707,6 +707,9 @@ public:
>   uint32_t getAge() const { return Age; }
>
>   StringRef getName() const { return Name; }
> +  StringRef Guid;
> +  uint32_t Age;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -714,10 +717,6 @@ private:
>     ulittle32_t Age;
>     // Name: Name of the PDB as a null-terminated string
>   };
> -
> -  StringRef Guid;
> -  uint32_t Age;
> -  StringRef Name;
> };
>
> // LF_STRING_ID
> @@ -737,15 +736,14 @@ public:
>   TypeIndex getId() const { return Id; }
>
>   StringRef getString() const { return String; }
> +  TypeIndex Id;
> +  StringRef String;
>
> private:
>   struct Layout {
>     TypeIndex id;
>     // Name: Name of the PDB as a null-terminated string
>   };
> -
> -  TypeIndex Id;
> -  StringRef String;
> };
>
> // LF_FUNC_ID
> @@ -768,6 +766,9 @@ public:
>   TypeIndex getFunctionType() const { return FunctionType; }
>
>   StringRef getName() const { return Name; }
> +  TypeIndex ParentScope;
> +  TypeIndex FunctionType;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -776,9 +777,6 @@ private:
>     // Name: The null-terminated name follows.
>   };
>
> -  TypeIndex ParentScope;
> -  TypeIndex FunctionType;
> -  StringRef Name;
> };
>
> // LF_UDT_SRC_LINE
> @@ -799,6 +797,9 @@ public:
>   TypeIndex getUDT() const { return UDT; }
>   TypeIndex getSourceFile() const { return SourceFile; }
>   uint32_t getLineNumber() const { return LineNumber; }
> +  TypeIndex UDT;
> +  TypeIndex SourceFile;
> +  uint32_t LineNumber;
>
> private:
>   struct Layout {
> @@ -807,9 +808,6 @@ private:
>     ulittle32_t LineNumber;
>   };
>
> -  TypeIndex UDT;
> -  TypeIndex SourceFile;
> -  uint32_t LineNumber;
> };
>
> // LF_UDT_MOD_SRC_LINE
> @@ -836,6 +834,10 @@ public:
>   TypeIndex getSourceFile() const { return SourceFile; }
>   uint32_t getLineNumber() const { return LineNumber; }
>   uint16_t getModule() const { return Module; }
> +  TypeIndex UDT;
> +  TypeIndex SourceFile;
> +  uint32_t LineNumber;
> +  uint16_t Module;
>
> private:
>   struct Layout {
> @@ -845,10 +847,6 @@ private:
>     ulittle16_t Module; // Module that contributes this UDT definition
>   };
>
> -  TypeIndex UDT;
> -  TypeIndex SourceFile;
> -  uint32_t LineNumber;
> -  uint16_t Module;
> };
>
> // LF_BUILDINFO
> @@ -867,13 +865,13 @@ public:
>                                                ArrayRef<uint8_t> &Data);
>
>   ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
> +  SmallVector<TypeIndex, 4> ArgIndices;
>
> private:
>   struct Layout {
>     ulittle16_t NumArgs; // Number of arguments
>                          // ArgTypes[]: Type indicies of arguments
>   };
> -  SmallVector<TypeIndex, 4> ArgIndices;
> };
>
> // LF_VFTABLE
> @@ -909,6 +907,12 @@ public:
>       return MethodNamesRef;
>     return MethodNames;
>   }
> +  TypeIndex CompleteClass;
> +  TypeIndex OverriddenVFTable;
> +  ulittle32_t VFPtrOffset;
> +  StringRef Name;
> +  ArrayRef<StringRef> MethodNamesRef;
> +  std::vector<StringRef> MethodNames;
>
> private:
>   struct Layout {
> @@ -920,17 +924,12 @@ private:
>     // names.
>   };
>
> -  TypeIndex CompleteClass;
> -  TypeIndex OverriddenVFTable;
> -  ulittle32_t VFPtrOffset;
> -  StringRef Name;
> -  ArrayRef<StringRef> MethodNamesRef;
> -  std::vector<StringRef> MethodNames;
> };
>
> // LF_ONEMETHOD
> class OneMethodRecord : public TypeRecord {
> public:
> +  OneMethodRecord() : TypeRecord(TypeRecordKind::OneMethod) {}
>   explicit OneMethodRecord(TypeRecordKind Kind) : TypeRecord(Kind) {}
>   OneMethodRecord(TypeIndex Type, MethodKind Kind, MethodOptions Options,
>                   MemberAccess Access, int32_t VFTableOffset, StringRef
> Name)
> @@ -956,6 +955,12 @@ public:
>     return Kind == MethodKind::IntroducingVirtual ||
>            Kind == MethodKind::PureIntroducingVirtual;
>   }
> +  TypeIndex Type;
> +  MethodKind Kind;
> +  MethodOptions Options;
> +  MemberAccess Access;
> +  int32_t VFTableOffset;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -966,12 +971,6 @@ private:
>     // Name: Null-terminated string
>   };
>
> -  TypeIndex Type;
> -  MethodKind Kind;
> -  MethodOptions Options;
> -  MemberAccess Access;
> -  int32_t VFTableOffset;
> -  StringRef Name;
> };
>
> // LF_METHODLIST
> @@ -989,6 +988,7 @@ public:
>   deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data);
>
>   ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
> +  std::vector<OneMethodRecord> Methods;
>
> private:
>   struct Layout {
> @@ -1000,7 +1000,6 @@ private:
>     //   VFTableOffset: int32_t offset in vftable
>   };
>
> -  std::vector<OneMethodRecord> Methods;
> };
>
> /// For method overload sets.  LF_METHOD
> @@ -1022,6 +1021,9 @@ public:
>   uint16_t getNumOverloads() const { return NumOverloads; }
>   TypeIndex getMethodList() const { return MethodList; }
>   StringRef getName() const { return Name; }
> +  uint16_t NumOverloads;
> +  TypeIndex MethodList;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -1030,9 +1032,6 @@ private:
>                              // Name: Null-terminated string
>   };
>
> -  uint16_t NumOverloads;
> -  TypeIndex MethodList;
> -  StringRef Name;
> };
>
> // LF_MEMBER
> @@ -1055,6 +1054,10 @@ public:
>   TypeIndex getType() const { return Type; }
>   uint64_t getFieldOffset() const { return FieldOffset; }
>   StringRef getName() const { return Name; }
> +  MemberAccess Access;
> +  TypeIndex Type;
> +  uint64_t FieldOffset;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -1064,10 +1067,6 @@ private:
>     // Name: Null-terminated string
>   };
>
> -  MemberAccess Access;
> -  TypeIndex Type;
> -  uint64_t FieldOffset;
> -  StringRef Name;
> };
>
> // LF_STMEMBER
> @@ -1088,6 +1087,9 @@ public:
>   MemberAccess getAccess() const { return Access; }
>   TypeIndex getType() const { return Type; }
>   StringRef getName() const { return Name; }
> +  MemberAccess Access;
> +  TypeIndex Type;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -1096,9 +1098,6 @@ private:
>     // Name: Null-terminated string
>   };
>
> -  MemberAccess Access;
> -  TypeIndex Type;
> -  StringRef Name;
> };
>
> // LF_ENUMERATE
> @@ -1119,6 +1118,9 @@ public:
>   MemberAccess getAccess() const { return Access; }
>   APSInt getValue() const { return Value; }
>   StringRef getName() const { return Name; }
> +  MemberAccess Access;
> +  APSInt Value;
> +  StringRef Name;
>
> private:
>   struct Layout {
> @@ -1127,9 +1129,6 @@ private:
>                             // Name: Null-terminated string
>   };
>
> -  MemberAccess Access;
> -  APSInt Value;
> -  StringRef Name;
> };
>
> // LF_VFUNCTAB
> @@ -1147,13 +1146,13 @@ public:
>                                            ArrayRef<uint8_t> &Data);
>
>   TypeIndex getType() const { return Type; }
> +  TypeIndex Type;
>
> private:
>   struct Layout {
>     ulittle16_t Pad0;
>     TypeIndex Type; // Type of vfptr
>   };
> -  TypeIndex Type;
> };
>
> // LF_BCLASS, LF_BINTERFACE
> @@ -1174,6 +1173,9 @@ public:
>   MemberAccess getAccess() const { return Access; }
>   TypeIndex getBaseType() const { return Type; }
>   uint64_t getBaseOffset() const { return Offset; }
> +  MemberAccess Access;
> +  TypeIndex Type;
> +  uint64_t Offset;
>
> private:
>   struct Layout {
> @@ -1181,9 +1183,6 @@ private:
>     TypeIndex BaseType;     // Base class type
>     // BaseOffset: LF_NUMERIC encoded byte offset of base from derived.
>   };
> -  MemberAccess Access;
> -  TypeIndex Type;
> -  uint64_t Offset;
> };
>
> // LF_VBCLASS, LF_IVBCLASS
> @@ -1208,6 +1207,11 @@ public:
>   TypeIndex getVBPtrType() const { return VBPtrType; }
>   uint64_t getVBPtrOffset() const { return VBPtrOffset; }
>   uint64_t getVTableIndex() const { return VTableIndex; }
> +  MemberAccess Access;
> +  TypeIndex BaseType;
> +  TypeIndex VBPtrType;
> +  uint64_t VBPtrOffset;
> +  uint64_t VTableIndex;
>
> private:
>   struct Layout {
> @@ -1217,11 +1221,6 @@ private:
>     // VBPtrOffset: Offset of vbptr from vfptr encoded as LF_NUMERIC.
>     // VBTableIndex: Index of vbase within vbtable encoded as LF_NUMERIC.
>   };
> -  MemberAccess Access;
> -  TypeIndex BaseType;
> -  TypeIndex VBPtrType;
> -  uint64_t VBPtrOffset;
> -  uint64_t VTableIndex;
> };
>
> /// LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST
> records
> @@ -1239,17 +1238,15 @@ public:
>
>   static Expected<ListContinuationRecord> deserialize(TypeRecordKind Kind,
>                                                       ArrayRef<uint8_t>
> &Data);
> +  TypeIndex ContinuationIndex;
>
> private:
>   struct Layout {
>     ulittle16_t Pad0;
>     TypeIndex ContinuationIndex;
>   };
> -  TypeIndex ContinuationIndex;
> };
>
> -typedef CVRecord<TypeLeafKind> CVType;
> -typedef msf::VarStreamArray<CVType> CVTypeArray;
> }
> }
>
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h Thu Aug 18
> 11:49:29 2016
> @@ -95,6 +95,7 @@ public:
>     return Error::success();
>   }
>
> +  bool empty() const { return bytesRemaining() == 0; }
>   void setOffset(uint32_t Off) { Offset = Off; }
>   uint32_t getOffset() const { return Offset; }
>   uint32_t getLength() const { return Stream.getLength(); }
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp Thu Aug 18
> 11:49:29 2016
> @@ -15,6 +15,52 @@
> using namespace llvm;
> using namespace llvm::codeview;
>
> +template <typename T>
> +static Error takeObject(ArrayRef<uint8_t> &Data, const T *&Res) {
> +  if (Data.size() < sizeof(*Res))
> +    return
> llvm::make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> +  Res = reinterpret_cast<const T *>(Data.data());
> +  Data = Data.drop_front(sizeof(*Res));
> +  return Error::success();
> +}
> +
> +static Error skipPadding(ArrayRef<uint8_t> &Data) {
> +  if (Data.empty())
> +    return Error::success();
> +  uint8_t Leaf = Data.front();
> +  if (Leaf < LF_PAD0)
> +    return Error::success();
> +  // Leaf is greater than 0xf0. We should advance by the number of bytes
> in
> +  // the low 4 bits.
> +  unsigned BytesToAdvance = Leaf & 0x0F;
> +  if (Data.size() < BytesToAdvance) {
> +    return llvm::make_error<CodeViewError>(cv_error_code::corrupt_record,
> +                                           "Invalid padding bytes!");
> +  }
> +  Data = Data.drop_front(BytesToAdvance);
> +  return Error::success();
> +}
> +
> +template <typename T>
> +static Expected<CVType> deserializeMemberRecord(ArrayRef<uint8_t> &Data,
> +                                                TypeLeafKind Kind) {
> +  ArrayRef<uint8_t> OldData = Data;
> +  TypeRecordKind RK = static_cast<TypeRecordKind>(Kind);
> +  auto ExpectedRecord = T::deserialize(RK, Data);
> +  if (!ExpectedRecord)
> +    return ExpectedRecord.takeError();
> +  assert(Data.size() < OldData.size());
> +  if (auto EC = skipPadding(Data))
> +    return std::move(EC);
> +
> +  CVType CVR;
> +  CVR.Type = Kind;
> +  CVR.Length = OldData.size() - Data.size();
> +  CVR.Data = OldData.slice(0, CVR.Length);
> +  CVR.RawData = CVR.Data;
> +  return CVR;
> +}
> +
> CVTypeVisitor::CVTypeVisitor(TypeVisitorCallbacks &Callbacks)
>     : Callbacks(Callbacks) {}
>
> @@ -45,7 +91,10 @@ Error CVTypeVisitor::visitTypeRecord(con
>   }
> #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
>                  \
>   TYPE_RECORD(EnumVal, EnumVal, AliasName)
> -#define MEMBER_RECORD(EnumName, EnumVal, Name)
> +#define MEMBER_RECORD(EnumName, EnumVal, Name)
>                                 \
> +  TYPE_RECORD(EnumName, EnumVal, Name)
> +#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
>                \
> +  MEMBER_RECORD(EnumName, EnumVal, AliasName)
> #include "llvm/DebugInfo/CodeView/TypeRecords.def"
>   }
>
> @@ -63,3 +112,39 @@ Error CVTypeVisitor::visitTypeStream(con
>   }
>   return Error::success();
> }
> +
> +Error CVTypeVisitor::visitFieldListMemberStream(ArrayRef<uint8_t> Data) {
> +  while (!Data.empty()) {
> +    const support::ulittle16_t *LeafValue;
> +    if (auto EC = takeObject(Data, LeafValue))
> +      return EC;
> +
> +    TypeLeafKind Leaf = static_cast<TypeLeafKind>(uint16_t(*LeafValue));
> +    CVType Record;
> +    switch (Leaf) {
> +    default:
> +      // Field list records do not describe their own length, so we cannot
> +      // continue parsing past a type that we don't know how to
> deserialize.
> +      return llvm::make_error<CodeViewError>(
> +          cv_error_code::unknown_member_record);
> +#define MEMBER_RECORD(EnumName, EnumVal, Name)
>                                 \
> +  case EnumName: {
>                                                             \
> +    auto ExpectedRecord = deserializeMemberRecord<Name##Record>(Data,
> Leaf);   \
> +    if (!ExpectedRecord)
>                                                       \
> +      return ExpectedRecord.takeError();
>                                       \
> +    auto &Record = *ExpectedRecord;
>                                            \
> +    if (auto EC = Callbacks.visitTypeBegin(Record))
>                            \
> +      return EC;
>                                                               \
> +    if (auto EC = visitKnownRecord<Name##Record>(Record, Callbacks))
>           \
> +      return EC;
>                                                               \
> +    if (auto EC = Callbacks.visitTypeEnd(Record))
>                              \
> +      return EC;
>                                                               \
> +    break;
>                                                                     \
> +  }
> +#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
>                \
> +  MEMBER_RECORD(EnumVal, EnumVal, AliasName)
> +#include "llvm/DebugInfo/CodeView/TypeRecords.def"
> +    }
> +  }
> +  return Error::success();
> +}
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp Thu Aug 18 11:49:29
> 2016
> @@ -24,6 +24,12 @@ static const EnumEntry<SymbolKind> Symbo
> #undef CV_SYMBOL
> };
>
> +static const EnumEntry<TypeLeafKind> TypeLeafNames[] = {
> +#define CV_TYPE(name, val) {#name, name},
> +#include "llvm/DebugInfo/CodeView/TypeRecords.def"
> +#undef CV_TYPE
> +};
> +
> static const EnumEntry<uint16_t> RegisterNames[] = {
>     CV_ENUM_CLASS_ENT(RegisterId, Unknown),
>     CV_ENUM_CLASS_ENT(RegisterId, VFrame),
> @@ -324,6 +330,10 @@ ArrayRef<EnumEntry<SymbolKind>> getSymbo
>   return makeArrayRef(SymbolTypeNames);
> }
>
> +ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames() {
> +  return makeArrayRef(TypeLeafNames);
> +}
> +
> ArrayRef<EnumEntry<uint16_t>> getRegisterNames() {
>   return makeArrayRef(RegisterNames);
> }
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeDeserializer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeDeserializer.cpp?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/TypeDeserializer.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/TypeDeserializer.cpp Thu Aug 18
> 11:49:29 2016
> @@ -11,71 +11,3 @@
>
> using namespace llvm;
> using namespace llvm::codeview;
> -
> -template <typename T>
> -static Error takeObject(ArrayRef<uint8_t> &Data, const T *&Res) {
> -  if (Data.size() < sizeof(*Res))
> -    return
> llvm::make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> -  Res = reinterpret_cast<const T *>(Data.data());
> -  Data = Data.drop_front(sizeof(*Res));
> -  return Error::success();
> -}
> -
> -Error TypeDeserializer::visitKnownRecord(const CVRecord<TypeLeafKind>
> &CVR,
> -                                         FieldListRecord &Record) {
> -  ArrayRef<uint8_t> FieldListRecordData = CVR.Data;
> -  auto ExpectedRecord =
> FieldListRecord::deserialize(TypeRecordKind::FieldList,
> -                                                     FieldListRecordData);
> -  if (!ExpectedRecord)
> -    return ExpectedRecord.takeError();
> -
> -  Record = *ExpectedRecord;
> -  ArrayRef<uint8_t> MemberData = Record.getFieldListData();
> -
> -  while (!MemberData.empty()) {
> -    const ulittle16_t *LeafPtr;
> -    if (auto EC = takeObject(MemberData, LeafPtr))
> -      return EC;
> -    TypeLeafKind Leaf = TypeLeafKind(unsigned(*LeafPtr));
> -    switch (Leaf) {
> -    default:
> -      // Field list records do not describe their own length, so we cannot
> -      // continue parsing past a type that we don't know how to
> deserialize.
> -      if (auto EC = Recipient.visitUnknownMember(CVR))
> -        return EC;
> -      return llvm::make_error<CodeViewError>(
> -          cv_error_code::unknown_member_record);
> -#define MEMBER_RECORD(EnumName, EnumVal, Name)
>                                 \
> -  case EnumName: {
>                                                             \
> -    TypeRecordKind RK = static_cast<TypeRecordKind>(Leaf);
>                     \
> -    Name##Record Member(RK);
>                                                   \
> -    if (auto EC = visitKnownMember(MemberData, Leaf, Member))
>                  \
> -      return EC;
>                                                               \
> -    break;
>                                                                     \
> -  }
> -#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
>                \
> -  MEMBER_RECORD(EnumVal, EnumVal, AliasName)
> -#include "llvm/DebugInfo/CodeView/TypeRecords.def"
> -    }
> -    if (auto EC = skipPadding(MemberData))
> -      return EC;
> -  }
> -  return Error::success();
> -}
> -
> -Error TypeDeserializer::skipPadding(ArrayRef<uint8_t> &Data) {
> -  if (Data.empty())
> -    return Error::success();
> -  uint8_t Leaf = Data.front();
> -  if (Leaf < LF_PAD0)
> -    return Error::success();
> -  // Leaf is greater than 0xf0. We should advance by the number of bytes
> in
> -  // the low 4 bits.
> -  unsigned BytesToAdvance = Leaf & 0x0F;
> -  if (Data.size() < BytesToAdvance) {
> -    return llvm::make_error<CodeViewError>(cv_error_code::corrupt_record,
> -                                           "Invalid padding bytes!");
> -  }
> -  Data = Data.drop_front(BytesToAdvance);
> -  return Error::success();
> -}
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp Thu Aug 18 11:49:29
> 2016
> @@ -206,21 +206,38 @@ Error CVTypeDumper::visitTypeBegin(const
>   // Reset Name to the empty string. If the visitor sets it, we know it.
>   Name = "";
>
> -  W->startLine() << getLeafTypeName(Record.Type) << " ("
> -                 << HexNumber(getNextTypeIndex()) << ") {\n";
> +  W->startLine() << getLeafTypeName(Record.Type);
> +  if (!IsInFieldList) {
> +    // If this is a field list member, don't record its type index
> because it
> +    // doesn't have one.  Only the outer field list has a type index.
> +    W->getOStream() << " (" << HexNumber(getNextTypeIndex()) << ")";
> +  }
> +  W->getOStream() << " {\n";
>   W->indent();
>   W->printEnum("TypeLeafKind", unsigned(Record.Type),
>                makeArrayRef(LeafTypeNames));
> +  if (Record.Type == LF_FIELDLIST) {
> +    // Record that we're in a field list so that members do not get
> assigned
> +    // type indices.
> +    assert(!IsInFieldList);
> +    IsInFieldList = true;
> +  }
>   return Error::success();
> }
>
> Error CVTypeDumper::visitTypeEnd(const CVRecord<TypeLeafKind> &Record) {
> -  if (Record.Type == LF_FIELDLIST)
> -    Name = "<field list>";
> +  if (Record.Type == LF_FIELDLIST) {
> +    assert(IsInFieldList);
> +    IsInFieldList = false;
> +  }
>
> -  // Always record some name for every type, even if Name is empty.
> CVUDTNames
> -  // is indexed by type index, and must have one entry for every type.
> -  recordType(Name);
> +  if (!IsInFieldList) {
> +    // Record every type that is not a field list member, even if Name is
> empty.
> +    // CVUDTNames is indexed by type index, and must have one entry for
> every
> +    // type.  Field list members are not recorded, and are only
> referenced by
> +    // their containing field list record.
> +    recordType(Name);
> +  }
>
>   if (PrintRecordBytes)
>     W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.Data));
> @@ -232,6 +249,12 @@ Error CVTypeDumper::visitTypeEnd(const C
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      FieldListRecord &FieldList) {
> +  TypeDeserializer Deserializer(*this);
> +  CVTypeVisitor Visitor(Deserializer);
> +  if (auto EC = Visitor.visitFieldListMemberStream(FieldList.Data))
> +    return EC;
> +
> +  Name = "<field list>";
>   return Error::success();
> }
>
> @@ -550,7 +573,6 @@ Error CVTypeDumper::visitUnknownMember(c
> }
>
> Error CVTypeDumper::visitUnknownType(const CVRecord<TypeLeafKind> &Record)
> {
> -  DictScope S(*W, "UnknownType");
>   W->printEnum("Kind", uint16_t(Record.Type), makeArrayRef(LeafTypeNames));
>   W->printNumber("Length", uint32_t(Record.Data.size()));
>   return Error::success();
> @@ -558,7 +580,6 @@ Error CVTypeDumper::visitUnknownType(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      NestedTypeRecord &Nested) {
> -  DictScope S(*W, "NestedType");
>   printTypeIndex("Type", Nested.getNestedType());
>   W->printString("Name", Nested.getName());
>   Name = Nested.getName();
> @@ -567,7 +588,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      OneMethodRecord &Method) {
> -  DictScope S(*W, "OneMethod");
>   MethodKind K = Method.getKind();
>   printMemberAttributes(Method.getAccess(), K, Method.getOptions());
>   printTypeIndex("Type", Method.getType());
> @@ -581,7 +601,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      OverloadedMethodRecord &Method) {
> -  DictScope S(*W, "OverloadedMethod");
>   W->printHex("MethodCount", Method.getNumOverloads());
>   printTypeIndex("MethodListIndex", Method.getMethodList());
>   W->printString("Name", Method.getName());
> @@ -591,7 +610,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      DataMemberRecord &Field) {
> -  DictScope S(*W, "DataMember");
>   printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
>                         MethodOptions::None);
>   printTypeIndex("Type", Field.getType());
> @@ -603,7 +621,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      StaticDataMemberRecord &Field) {
> -  DictScope S(*W, "StaticDataMember");
>   printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
>                         MethodOptions::None);
>   printTypeIndex("Type", Field.getType());
> @@ -614,14 +631,12 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      VFPtrRecord &VFTable) {
> -  DictScope S(*W, "VFPtr");
>   printTypeIndex("Type", VFTable.getType());
>   return Error::success();
> }
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      EnumeratorRecord &Enum) {
> -  DictScope S(*W, "Enumerator");
>   printMemberAttributes(Enum.getAccess(), MethodKind::Vanilla,
>                         MethodOptions::None);
>   W->printNumber("EnumValue", Enum.getValue());
> @@ -632,7 +647,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      BaseClassRecord &Base) {
> -  DictScope S(*W, "BaseClass");
>   printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
>                         MethodOptions::None);
>   printTypeIndex("BaseType", Base.getBaseType());
> @@ -642,7 +656,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      VirtualBaseClassRecord &Base) {
> -  DictScope S(*W, "VirtualBaseClass");
>   printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
>                         MethodOptions::None);
>   printTypeIndex("BaseType", Base.getBaseType());
> @@ -654,7 +667,6 @@ Error CVTypeDumper::visitKnownRecord(con
>
> Error CVTypeDumper::visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
>                                      ListContinuationRecord &Cont) {
> -  DictScope S(*W, "ListContinuation");
>   printTypeIndex("ContinuationIndex", Cont.getContinuationIndex());
>   return Error::success();
> }
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp Thu Aug 18 11:49:29
> 2016
> @@ -8,8 +8,9 @@
>
> //===----------------------------------------------------------------------===//
>
> #include "llvm/DebugInfo/CodeView/TypeRecord.h"
> -#include "llvm/DebugInfo/CodeView/TypeIndex.h"
> #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
> +#include "llvm/DebugInfo/CodeView/TypeIndex.h"
> +#include "llvm/DebugInfo/MSF/ByteStream.h"
>
> using namespace llvm;
> using namespace llvm::codeview;
> @@ -116,7 +117,9 @@ NestedTypeRecord::deserialize(TypeRecord
>
> Expected<FieldListRecord>
> FieldListRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data)
> {
> -  return FieldListRecord(Data);
> +  auto FieldListData = Data;
> +  Data = ArrayRef<uint8_t>();
> +  return FieldListRecord(FieldListData);
> }
>
> Expected<ArrayRecord> ArrayRecord::deserialize(TypeRecordKind Kind,
> @@ -448,7 +451,7 @@ bool PointerRecord::remapTypeIndices(Arr
>   bool Success = true;
>   Success &= remapIndex(IndexMap, ReferentType);
>   if (isPointerToMember())
> -    Success &= MemberInfo.remapTypeIndices(IndexMap);
> +    Success &= MemberInfo->remapTypeIndices(IndexMap);
>   return Success;
> }
>
>
> Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp Thu Aug 18
> 11:49:29 2016
> @@ -84,6 +84,11 @@ private:
>
>   Error visitKnownRecordImpl(FieldListRecord &Record) {
>     // Don't do anything, this will get written in the call to
> visitTypeEnd().
> +    TypeDeserializer Deserializer(*this);
> +    CVTypeVisitor Visitor(Deserializer);
> +
> +    if (auto EC = Visitor.visitFieldListMemberStream(Record.Data))
> +      return std::move(EC);
>     return Error::success();
>   }
>
> @@ -102,6 +107,7 @@ private:
>
>   TypeTableBuilder &DestStream;
>
> +  bool IsInFieldList{false};
>   size_t BeginIndexMapSize = 0;
>
>   /// Map from source type index to destination type index. Indexed by
> source
> @@ -112,7 +118,10 @@ private:
> } // end anonymous namespace
>
> Error TypeStreamMerger::visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) {
> -  if (Rec.Type != TypeLeafKind::LF_FIELDLIST)
> +  if (Rec.Type == TypeLeafKind::LF_FIELDLIST) {
> +    assert(!IsInFieldList);
> +    IsInFieldList = true;
> +  } else
>     BeginIndexMapSize = IndexMap.size();
>   return Error::success();
> }
> @@ -121,7 +130,8 @@ Error TypeStreamMerger::visitTypeEnd(con
>   if (Rec.Type == TypeLeafKind::LF_FIELDLIST) {
>     IndexMap.push_back(DestStream.writeFieldList(FieldBuilder));
>     FieldBuilder.reset();
> -  } else {
> +    IsInFieldList = false;
> +  } else if (!IsInFieldList) {
>     assert(IndexMap.size() == BeginIndexMapSize + 1);
>   }
>   return Error::success();
>
> Modified: llvm/trunk/test/DebugInfo/COFF/big-type.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/big-type.ll?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/COFF/big-type.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/big-type.ll Thu Aug 18 11:49:29 2016
> @@ -5,6 +5,7 @@
> ; CHECK-LABEL: FieldList (0x1000)
> ; CHECK-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT: Enumerator {
> +; CHECK-NEXT:   TypeLeafKind: LF_ENUMERATE (0x1502)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   EnumValue: 5460
> ; CHECK-NEXT:   Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE5461
> @@ -14,6 +15,7 @@
> ; CHECK-LABEL: FieldList (0x1001)
> ; CHECK-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT: Enumerator {
> +; CHECK-NEXT:   TypeLeafKind: LF_ENUMERATE (0x1502)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   EnumValue: 4095
> ; CHECK-NEXT:   Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE4096
> @@ -23,6 +25,7 @@
> ; CHECK-LABEL: FieldList (0x1002)
> ; CHECK-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT: Enumerator {
> +; CHECK-NEXT:   TypeLeafKind: LF_ENUMERATE (0x1502)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   EnumValue: 2730
> ; CHECK-NEXT:   Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE2731
> @@ -32,6 +35,7 @@
> ; CHECK-LABEL: FieldList (0x1003)
> ; CHECK-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT: Enumerator {
> +; CHECK-NEXT:   TypeLeafKind: LF_ENUMERATE (0x1502)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   EnumValue: 1365
> ; CHECK-NEXT:   Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE1366
> @@ -41,6 +45,7 @@
> ; CHECK-LABEL: FieldList (0x1004)
> ; CHECK-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT: Enumerator {
> +; CHECK-NEXT:   TypeLeafKind: LF_ENUMERATE (0x1502)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   EnumValue: 0
> ; CHECK-NEXT:   Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE1
>
> Modified: llvm/trunk/test/DebugInfo/COFF/enum.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/enum.ll?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/COFF/enum.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/enum.ll Thu Aug 18 11:49:29 2016
> @@ -8,6 +8,7 @@
> ; CHECK:       FieldList (0x1000) {
> ; CHECK-NEXT:    TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT:    Enumerator {
> +; CHECK-NEXT:      TypeLeafKind: LF_ENUMERATE (0x1502)
> ; CHECK-NEXT:      AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:      EnumValue: 0
> ; CHECK-NEXT:      Name: BLAH
>
> Modified: llvm/trunk/test/DebugInfo/COFF/inheritance.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/inheritance.ll?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/COFF/inheritance.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/inheritance.ll Thu Aug 18 11:49:29 2016
> @@ -16,11 +16,13 @@
> ; CHECK:        FieldList ({{.*}}) {
> ; CHECK-NEXT:     TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT:     BaseClass {
> +; CHECK-NEXT:       TypeLeafKind: LF_BCLASS (0x1400)
> ; CHECK-NEXT:       AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:       BaseType: B ({{.*}})
> ; CHECK-NEXT:       BaseOffset: 0x8
> ; CHECK-NEXT:     }
> ; CHECK-NEXT:     BaseClass {
> +; CHECK-NEXT:       TypeLeafKind: LF_BCLASS (0x1400)
> ; CHECK-NEXT:       AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:       BaseType: C ({{.*}})
> ; CHECK-NEXT:       BaseOffset: 0x18
> @@ -31,6 +33,7 @@
> ; CHECK:        FieldList ({{.*}}) {
> ; CHECK-NEXT:     TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT:     VirtualBaseClass {
> +; CHECK-NEXT:       TypeLeafKind: LF_VBCLASS (0x1401)
> ; CHECK-NEXT:       AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:       BaseType: A ({{.*}})
> ; CHECK-NEXT:       VBPtrType: const int* ({{.*}})
> @@ -43,6 +46,7 @@
> ; CHECK:        FieldList ({{.*}}) {
> ; CHECK-NEXT:     TypeLeafKind: LF_FIELDLIST (0x1203)
> ; CHECK-NEXT:     VirtualBaseClass {
> +; CHECK-NEXT:       TypeLeafKind: LF_VBCLASS (0x1401)
> ; CHECK-NEXT:       AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:       BaseType: A ({{.*}})
> ; CHECK-NEXT:       VBPtrType: const int* ({{.*}})
>
> Modified: llvm/trunk/test/DebugInfo/COFF/virtual-method-kinds.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/virtual-method-kinds.ll?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/COFF/virtual-method-kinds.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/virtual-method-kinds.ll Thu Aug 18
> 11:49:29 2016
> @@ -20,12 +20,14 @@
> ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
>
> ; CHECK:      OneMethod {
> +; CHECK-NEXT:   TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   MethodKind: Virtual (0x1)
> ; CHECK-NEXT:   Type: void C::() ({{.*}})
> ; CHECK-NEXT:   Name: f
> ; CHECK-NEXT: }
> ; CHECK-NEXT: OneMethod {
> +; CHECK-NEXT:   TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   MethodKind: Virtual (0x1)
> ; CHECK-NEXT:   Type: void C::() ({{.*}})
> @@ -33,12 +35,14 @@
> ; CHECK-NEXT: }
>
> ; CHECK:      OneMethod {
> +; CHECK-NEXT:   TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   MethodKind: PureVirtual (0x5)
> ; CHECK-NEXT:   Type: void B::() ({{.*}})
> ; CHECK-NEXT:   Name: f
> ; CHECK-NEXT: }
> ; CHECK-NEXT: OneMethod {
> +; CHECK-NEXT:   TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   MethodKind: Virtual (0x1)
> ; CHECK-NEXT:   Type: void B::() ({{.*}})
> @@ -46,6 +50,7 @@
> ; CHECK-NEXT: }
>
> ; CHECK:      OneMethod {
> +; CHECK-NEXT:   TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   MethodKind: IntroducingVirtual (0x4)
> ; CHECK-NEXT:   Type: void A::() ({{.*}})
> @@ -53,6 +58,7 @@
> ; CHECK-NEXT:   Name: f
> ; CHECK-NEXT: }
> ; CHECK-NEXT: OneMethod {
> +; CHECK-NEXT:   TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:   AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:   MethodKind: PureIntroducingVirtual (0x6)
> ; CHECK-NEXT:   Type: void A::() ({{.*}})
>
> Modified: llvm/trunk/test/DebugInfo/COFF/virtual-methods.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/virtual-methods.ll?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/COFF/virtual-methods.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/virtual-methods.ll Thu Aug 18 11:49:29
> 2016
> @@ -64,6 +64,7 @@
>
> ; CHECK:      FieldList ({{.*}}) {
> ; CHECK:        OneMethod {
> +; CHECK-NEXT:     TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:     AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:     MethodKind: Virtual (0x1)
> ; CHECK-NEXT:     Type: int C::() ([[C_g]])
> @@ -87,6 +88,7 @@
>
> ; CHECK:      FieldList ({{.*}}) {
> ; CHECK:        OneMethod {
> +; CHECK-NEXT:     TypeLeafKind: LF_ONEMETHOD (0x1511)
> ; CHECK-NEXT:     AccessSpecifier: Public (0x3)
> ; CHECK-NEXT:     MethodKind: Virtual (0x1)
> ; CHECK-NEXT:     Type: int D::() ([[D_g]])
>
> Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test?rev=279089&r1=279088&r2=279089&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test (original)
> +++ llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test Thu Aug 18 11:49:29
> 2016
> @@ -111,26 +111,31 @@
> ; EMPTY-NEXT:       FieldList (0x1002) {
> ; EMPTY-NEXT:         TypeLeafKind: LF_FIELDLIST (0x1203)
> ; EMPTY-NEXT:         Enumerator {
> +; EMPTY-NEXT:           TypeLeafKind: LF_ENUMERATE (0x1502)
> ; EMPTY-NEXT:           AccessSpecifier: Public (0x3)
> ; EMPTY-NEXT:           EnumValue: 1
> ; EMPTY-NEXT:           Name: apartment
> ; EMPTY-NEXT:         }
> ; EMPTY-NEXT:         Enumerator {
> +; EMPTY-NEXT:           TypeLeafKind: LF_ENUMERATE (0x1502)
> ; EMPTY-NEXT:           AccessSpecifier: Public (0x3)
> ; EMPTY-NEXT:           EnumValue: 2
> ; EMPTY-NEXT:           Name: single
> ; EMPTY-NEXT:         }
> ; EMPTY-NEXT:         Enumerator {
> +; EMPTY-NEXT:           TypeLeafKind: LF_ENUMERATE (0x1502)
> ; EMPTY-NEXT:           AccessSpecifier: Public (0x3)
> ; EMPTY-NEXT:           EnumValue: 3
> ; EMPTY-NEXT:           Name: free
> ; EMPTY-NEXT:         }
> ; EMPTY-NEXT:         Enumerator {
> +; EMPTY-NEXT:           TypeLeafKind: LF_ENUMERATE (0x1502)
> ; EMPTY-NEXT:           AccessSpecifier: Public (0x3)
> ; EMPTY-NEXT:           EnumValue: 4
> ; EMPTY-NEXT:           Name: neutral
> ; EMPTY-NEXT:         }
> ; EMPTY-NEXT:         Enumerator {
> +; EMPTY-NEXT:           TypeLeafKind: LF_ENUMERATE (0x1502)
> ; EMPTY-NEXT:           AccessSpecifier: Public (0x3)
> ; EMPTY-NEXT:           EnumValue: 5
> ; EMPTY-NEXT:           Name: both
>
> Added: llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test?rev=279089&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test (added)
> +++ llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test Thu Aug 18
> 11:49:29 2016
> @@ -0,0 +1,1087 @@
> +; RUN: llvm-pdbdump pdb2yaml -tpi-stream %p/Inputs/empty.pdb \
> +; RUN:   | FileCheck -check-prefix=YAML %s
> +
> +YAML: ---
> +YAML: MSF:
> +YAML:   SuperBlock:
> +YAML:     BlockSize:       4096
> +YAML:     FreeBlockMap:    2
> +YAML:     NumBlocks:       25
> +YAML:     NumDirectoryBytes: 136
> +YAML:     Unknown1:        0
> +YAML:     BlockMapAddr:    24
> +YAML:   NumDirectoryBlocks: 1
> +YAML:   DirectoryBlocks: [ 23 ]
> +YAML:   NumStreams:      0
> +YAML:   FileSize:        102400
> +YAML: TpiStream:
> +YAML:   Version:         VC80
> +YAML:   Records:
> +YAML:     - Kind:            LF_ARGLIST
> +YAML:       ArgList:
> +YAML:         ArgIndices:      [  ]
> +YAML:     - Kind:            LF_PROCEDURE
> +YAML:       Procedure:
> +YAML:         ReturnType:      116
> +YAML:         CallConv:        NearC
> +YAML:         Options:         [ None ]
> +YAML:         ParameterCount:  0
> +YAML:         ArgumentList:    4096
> +YAML:     - Kind:
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160823/b1ebc3b8/attachment-0001.html>


More information about the llvm-commits mailing list