From 83849415dea6e6fd21cf8c2dbc402c119725805c Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 2 Sep 2016 22:19:01 +0000 Subject: [PATCH] [codeview] Make FieldList records print as a yaml sequence. Before we were kind of imitating the behavior of a Yaml sequence by outputting each record one after the other. This makes it a little cumbersome when we want to go the other direction -- from Yaml to Pdb. So this treats FieldList records as no different than any other list of records, by printing them as a Yaml sequence with the exact same format. llvm-svn: 280549 --- llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test | 964 ++++++++++++------------ llvm/tools/llvm-pdbdump/CodeViewYaml.cpp | 45 ++ llvm/tools/llvm-pdbdump/CodeViewYaml.h | 10 +- 3 files changed, 536 insertions(+), 483 deletions(-) diff --git a/llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test b/llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test index 0ad407a..1e97725 100644 --- a/llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test @@ -29,31 +29,31 @@ YAML: ParameterCount: 0 YAML: ArgumentList: 4096 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: apartment -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: single -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 3 -YAML: Name: free -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 4 -YAML: Name: neutral -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 5 -YAML: Name: both +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: apartment +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: single +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 3 +YAML: Name: free +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 4 +YAML: Name: neutral +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 5 +YAML: Name: both YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 5 @@ -121,21 +121,21 @@ YAML: VFTableOffset: -1 YAML: Name: '' YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4099 -YAML: Name: threading_e -YAML: Kind: LF_METHOD -YAML: OverloadedMethod: -YAML: NumOverloads: 2 -YAML: MethodList: 4105 -YAML: Name: threadingAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4099 -YAML: FieldOffset: 0 -YAML: Name: value +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4099 +YAML: Name: threading_e +YAML: - Kind: LF_METHOD +YAML: OverloadedMethod: +YAML: NumOverloads: 2 +YAML: MethodList: 4105 +YAML: Name: threadingAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4099 +YAML: FieldOffset: 0 +YAML: Name: value YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 4 @@ -150,21 +150,21 @@ YAML: VTableShape: 0 YAML: Size: 4 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 0 -YAML: Name: native -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: com -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: managed +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 0 +YAML: Name: native +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: com +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: managed YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 3 @@ -251,27 +251,27 @@ YAML: VFTableOffset: -1 YAML: Name: '' YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4109 -YAML: Name: type_e -YAML: Kind: LF_METHOD -YAML: OverloadedMethod: -YAML: NumOverloads: 3 -YAML: MethodList: 4117 -YAML: Name: event_receiverAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4109 -YAML: FieldOffset: 0 -YAML: Name: type -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 48 -YAML: FieldOffset: 4 -YAML: Name: layout_dependent +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4109 +YAML: Name: type_e +YAML: - Kind: LF_METHOD +YAML: OverloadedMethod: +YAML: NumOverloads: 3 +YAML: MethodList: 4117 +YAML: Name: event_receiverAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4109 +YAML: FieldOffset: 0 +YAML: Name: type +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 48 +YAML: FieldOffset: 4 +YAML: Name: layout_dependent YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 6 @@ -286,21 +286,21 @@ YAML: VTableShape: 0 YAML: Size: 8 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 0 -YAML: Name: never -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: allowed -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: always +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 0 +YAML: Name: never +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: allowed +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: always YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 3 @@ -368,21 +368,21 @@ YAML: VFTableOffset: -1 YAML: Name: '' YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4121 -YAML: Name: type_e -YAML: Kind: LF_METHOD -YAML: OverloadedMethod: -YAML: NumOverloads: 2 -YAML: MethodList: 4127 -YAML: Name: aggregatableAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4121 -YAML: FieldOffset: 0 -YAML: Name: type +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4121 +YAML: Name: type_e +YAML: - Kind: LF_METHOD +YAML: OverloadedMethod: +YAML: NumOverloads: 2 +YAML: MethodList: 4127 +YAML: Name: aggregatableAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4121 +YAML: FieldOffset: 0 +YAML: Name: type YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 4 @@ -405,16 +405,16 @@ YAML: UniqueName: '.?AW4type_e@event_sourceAttribute@__vc_attribute YAML: UnderlyingType: 116 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 0 -YAML: Name: speed -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: size +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 0 +YAML: Name: speed +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: size YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 2 @@ -482,37 +482,37 @@ YAML: VFTableOffset: -1 YAML: Name: '' YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4130 -YAML: Name: type_e -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4132 -YAML: Name: optimize_e -YAML: Kind: LF_METHOD -YAML: OverloadedMethod: -YAML: NumOverloads: 2 -YAML: MethodList: 4138 -YAML: Name: event_sourceAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4130 -YAML: FieldOffset: 0 -YAML: Name: type -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4132 -YAML: FieldOffset: 4 -YAML: Name: optimize -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 48 -YAML: FieldOffset: 8 -YAML: Name: decorate +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4130 +YAML: Name: type_e +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4132 +YAML: Name: optimize_e +YAML: - Kind: LF_METHOD +YAML: OverloadedMethod: +YAML: NumOverloads: 2 +YAML: MethodList: 4138 +YAML: Name: event_sourceAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4130 +YAML: FieldOffset: 0 +YAML: Name: type +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4132 +YAML: FieldOffset: 4 +YAML: Name: optimize +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 48 +YAML: FieldOffset: 8 +YAML: Name: decorate YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 7 @@ -527,36 +527,36 @@ YAML: VTableShape: 0 YAML: Size: 12 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: dll -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: exe -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 3 -YAML: Name: service -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 4 -YAML: Name: unspecified -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: EXE -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 3 -YAML: Name: SERVICE +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: dll +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: exe +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 3 +YAML: Name: service +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 4 +YAML: Name: unspecified +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: EXE +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 3 +YAML: Name: SERVICE YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 6 @@ -655,105 +655,105 @@ YAML: VFTableOffset: -1 YAML: Name: '' YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4142 -YAML: Name: type_e -YAML: Kind: LF_METHOD -YAML: OverloadedMethod: -YAML: NumOverloads: 3 -YAML: MethodList: 4152 -YAML: Name: moduleAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4142 -YAML: FieldOffset: 0 -YAML: Name: type -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 4 -YAML: Name: name -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 8 -YAML: Name: version -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 12 -YAML: Name: uuid -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 116 -YAML: FieldOffset: 16 -YAML: Name: lcid -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 48 -YAML: FieldOffset: 20 -YAML: Name: control -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 24 -YAML: Name: helpstring -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 116 -YAML: FieldOffset: 28 -YAML: Name: helpstringcontext -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 32 -YAML: Name: helpstringdll -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 36 -YAML: Name: helpfile -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 116 -YAML: FieldOffset: 40 -YAML: Name: helpcontext -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 48 -YAML: FieldOffset: 44 -YAML: Name: hidden -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 48 -YAML: FieldOffset: 45 -YAML: Name: restricted -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 48 -YAML: Name: custom -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4146 -YAML: FieldOffset: 52 -YAML: Name: resource_name +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4142 +YAML: Name: type_e +YAML: - Kind: LF_METHOD +YAML: OverloadedMethod: +YAML: NumOverloads: 3 +YAML: MethodList: 4152 +YAML: Name: moduleAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4142 +YAML: FieldOffset: 0 +YAML: Name: type +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 4 +YAML: Name: name +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 8 +YAML: Name: version +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 12 +YAML: Name: uuid +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 116 +YAML: FieldOffset: 16 +YAML: Name: lcid +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 48 +YAML: FieldOffset: 20 +YAML: Name: control +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 24 +YAML: Name: helpstring +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 116 +YAML: FieldOffset: 28 +YAML: Name: helpstringcontext +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 32 +YAML: Name: helpstringdll +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 36 +YAML: Name: helpfile +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 116 +YAML: FieldOffset: 40 +YAML: Name: helpcontext +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 48 +YAML: FieldOffset: 44 +YAML: Name: hidden +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 48 +YAML: FieldOffset: 45 +YAML: Name: restricted +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 48 +YAML: Name: custom +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4146 +YAML: FieldOffset: 52 +YAML: Name: resource_name YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 19 @@ -768,156 +768,156 @@ YAML: VTableShape: 0 YAML: Size: 56 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 0 -YAML: Name: eAnyUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: eCoClassUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: eCOMInterfaceUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 6 -YAML: Name: eInterfaceUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 8 -YAML: Name: eMemberUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 16 -YAML: Name: eMethodUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 32 -YAML: Name: eInterfaceMethodUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 64 -YAML: Name: eInterfaceMemberUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 128 -YAML: Name: eCoClassMemberUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 256 -YAML: Name: eCoClassMethodUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 768 -YAML: Name: eGlobalMethodUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1024 -YAML: Name: eGlobalDataUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2048 -YAML: Name: eClassUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 4096 -YAML: Name: eInterfaceParameterUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 12288 -YAML: Name: eMethodParameterUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 16384 -YAML: Name: eIDLModuleUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: -32768 -YAML: Name: eAnonymousUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 65536 -YAML: Name: eTypedefUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 131072 -YAML: Name: eUnionUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 262144 -YAML: Name: eEnumUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 524288 -YAML: Name: eDefineTagUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1048576 -YAML: Name: eStructUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2097152 -YAML: Name: eLocalUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 4194304 -YAML: Name: ePropertyUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 8388608 -YAML: Name: eEventUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 16777216 -YAML: Name: eTemplateUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 16777216 -YAML: Name: eModuleUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 33554432 -YAML: Name: eIllegalUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 67108864 -YAML: Name: eAsynchronousUsage -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 4161535 -YAML: Name: eAnyIDLUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 0 +YAML: Name: eAnyUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: eCoClassUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: eCOMInterfaceUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 6 +YAML: Name: eInterfaceUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 8 +YAML: Name: eMemberUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 16 +YAML: Name: eMethodUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 32 +YAML: Name: eInterfaceMethodUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 64 +YAML: Name: eInterfaceMemberUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 128 +YAML: Name: eCoClassMemberUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 256 +YAML: Name: eCoClassMethodUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 768 +YAML: Name: eGlobalMethodUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1024 +YAML: Name: eGlobalDataUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2048 +YAML: Name: eClassUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 4096 +YAML: Name: eInterfaceParameterUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 12288 +YAML: Name: eMethodParameterUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 16384 +YAML: Name: eIDLModuleUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: -32768 +YAML: Name: eAnonymousUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 65536 +YAML: Name: eTypedefUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 131072 +YAML: Name: eUnionUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 262144 +YAML: Name: eEnumUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 524288 +YAML: Name: eDefineTagUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1048576 +YAML: Name: eStructUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2097152 +YAML: Name: eLocalUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 4194304 +YAML: Name: ePropertyUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 8388608 +YAML: Name: eEventUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 16777216 +YAML: Name: eTemplateUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 16777216 +YAML: Name: eModuleUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 33554432 +YAML: Name: eIllegalUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 67108864 +YAML: Name: eAsynchronousUsage +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 4161535 +YAML: Name: eAnyIDLUsage YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 30 @@ -960,24 +960,24 @@ YAML: ArgumentList: 4159 YAML: ThisPointerAdjustment: 0 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4156 -YAML: Name: usage_e -YAML: Kind: LF_ONEMETHOD -YAML: OneMethod: -YAML: Type: 4160 -YAML: Kind: Vanilla -YAML: Options: [ None ] -YAML: Access: Public -YAML: VFTableOffset: -1 -YAML: Name: usageAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 117 -YAML: FieldOffset: 0 -YAML: Name: value +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4156 +YAML: Name: usage_e +YAML: - Kind: LF_ONEMETHOD +YAML: OneMethod: +YAML: Type: 4160 +YAML: Kind: Vanilla +YAML: Options: [ None ] +YAML: Access: Public +YAML: VFTableOffset: -1 +YAML: Name: usageAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 117 +YAML: FieldOffset: 0 +YAML: Name: value YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 3 @@ -992,26 +992,26 @@ YAML: VTableShape: 0 YAML: Size: 4 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 0 -YAML: Name: eBoolean -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 1 -YAML: Name: eInteger -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 2 -YAML: Name: eFloat -YAML: Kind: LF_ENUMERATE -YAML: Enumerator: -YAML: Access: Public -YAML: Value: 3 -YAML: Name: eDouble +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 0 +YAML: Name: eBoolean +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 1 +YAML: Name: eInteger +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 2 +YAML: Name: eFloat +YAML: - Kind: LF_ENUMERATE +YAML: Enumerator: +YAML: Access: Public +YAML: Value: 3 +YAML: Name: eDouble YAML: - Kind: LF_ENUM YAML: Enum: YAML: NumEnumerators: 4 @@ -1054,24 +1054,24 @@ YAML: ArgumentList: 4167 YAML: ThisPointerAdjustment: 0 YAML: - Kind: LF_FIELDLIST YAML: FieldList: -YAML: Kind: LF_NESTTYPE -YAML: NestedType: -YAML: Type: 4164 -YAML: Name: type_e -YAML: Kind: LF_ONEMETHOD -YAML: OneMethod: -YAML: Type: 4168 -YAML: Kind: Vanilla -YAML: Options: [ None ] -YAML: Access: Public -YAML: VFTableOffset: -1 -YAML: Name: v1_alttypeAttribute -YAML: Kind: LF_MEMBER -YAML: DataMember: -YAML: Access: Public -YAML: Type: 4164 -YAML: FieldOffset: 0 -YAML: Name: type +YAML: - Kind: LF_NESTTYPE +YAML: NestedType: +YAML: Type: 4164 +YAML: Name: type_e +YAML: - Kind: LF_ONEMETHOD +YAML: OneMethod: +YAML: Type: 4168 +YAML: Kind: Vanilla +YAML: Options: [ None ] +YAML: Access: Public +YAML: VFTableOffset: -1 +YAML: Name: v1_alttypeAttribute +YAML: - Kind: LF_MEMBER +YAML: DataMember: +YAML: Access: Public +YAML: Type: 4164 +YAML: FieldOffset: 0 +YAML: Name: type YAML: - Kind: LF_STRUCTURE YAML: Class: YAML: MemberCount: 3 diff --git a/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp b/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp index e75f454..e9dcade 100644 --- a/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp +++ b/llvm/tools/llvm-pdbdump/CodeViewYaml.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "CodeViewYaml.h" +#include "PdbYaml.h" #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h" #include "llvm/DebugInfo/CodeView/EnumTables.h" @@ -25,6 +26,38 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(OneMethodRecord) LLVM_YAML_IS_SEQUENCE_VECTOR(VFTableSlotKind) LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef) LLVM_YAML_IS_SEQUENCE_VECTOR(CVType) +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbTpiRecord) + +namespace { +struct FieldListRecordSplitter : public TypeVisitorCallbacks { +public: + explicit FieldListRecordSplitter( + std::vector &Records) + : Records(Records) {} + +#define TYPE_RECORD(EnumName, EnumVal, Name) +#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) +#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) +#define MEMBER_RECORD(EnumName, EnumVal, Name) \ + Error visitKnownRecord(const CVType &CVT, Name##Record &Record) override { \ + visitKnownRecordImpl(CVT); \ + return Error::success(); \ + } +#include "llvm/DebugInfo/CodeView/TypeRecords.def" + +private: + void visitKnownRecordImpl(const CVType &CVT) { + llvm::pdb::yaml::PdbTpiRecord R; + R.Record = CVT; + R.RecordData.assign(CVT.RawData.begin(), CVT.RawData.end()); + R.Record.Data = R.RecordData; + R.Record.RawData = R.RecordData; + Records.push_back(std::move(R)); + } + + std::vector &Records; +}; +} namespace llvm { namespace yaml { @@ -518,3 +551,15 @@ llvm::codeview::yaml::YamlTypeDumperCallbacks::visitTypeBegin( YamlIO.mapRequired("Kind", K); return K; } + +void llvm::codeview::yaml::YamlTypeDumperCallbacks::visitKnownRecordImpl( + const char *Name, const CVType &Type, FieldListRecord &FieldList) { + + std::vector Records; + if (YamlIO.outputting()) { + FieldListRecordSplitter Splitter(Records); + CVTypeVisitor V(Splitter); + consumeError(V.visitFieldListMemberStream(FieldList.Data)); + } + YamlIO.mapRequired(Name, Records); +} diff --git a/llvm/tools/llvm-pdbdump/CodeViewYaml.h b/llvm/tools/llvm-pdbdump/CodeViewYaml.h index 8932d00..ccf7e40 100644 --- a/llvm/tools/llvm-pdbdump/CodeViewYaml.h +++ b/llvm/tools/llvm-pdbdump/CodeViewYaml.h @@ -27,7 +27,7 @@ public: #define TYPE_RECORD(EnumName, EnumVal, Name) \ Error visitKnownRecord(const CVRecord &CVR, \ Name##Record &Record) override { \ - YamlIO.mapRequired(#Name, Record); \ + visitKnownRecordImpl(#Name, CVR, Record); \ return Error::success(); \ } #define MEMBER_RECORD(EnumName, EnumVal, Name) \ @@ -37,6 +37,14 @@ public: #include "llvm/DebugInfo/CodeView/TypeRecords.def" private: + template + void visitKnownRecordImpl(const char *Name, const CVType &Type, T &Record) { + YamlIO.mapRequired(Name, Record); + } + + void visitKnownRecordImpl(const char *Name, const CVType &Type, + FieldListRecord &FieldList); + llvm::yaml::IO &YamlIO; }; } -- 2.7.4