diff --git a/lld/test/COFF/Inputs/pdb-type-server-invalid-path.yaml b/lld/test/COFF/Inputs/pdb-type-server-invalid-path.yaml --- a/lld/test/COFF/Inputs/pdb-type-server-invalid-path.yaml +++ b/lld/test/COFF/Inputs/pdb-type-server-invalid-path.yaml @@ -68,7 +68,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{8DABD2A0-28FF-CB43-9BAF-175B77B76414}' + Guid: '{A0D2AB8D-FF28-43CB-9BAF-175B77B76414}' Age: 1 Name: 'c:\some_invalid_path_AABB98765\pdb-diff-cl.pdb' - Name: '.text$mn' diff --git a/lld/test/COFF/Inputs/pdb-type-server-missing-2.yaml b/lld/test/COFF/Inputs/pdb-type-server-missing-2.yaml --- a/lld/test/COFF/Inputs/pdb-type-server-missing-2.yaml +++ b/lld/test/COFF/Inputs/pdb-type-server-missing-2.yaml @@ -9,7 +9,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' + Guid: '{1B19DF01-BF22-426B-96CE-5258B8329FE5}' Age: 18 Name: 'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb' - Name: '.text$mn' diff --git a/lld/test/COFF/Inputs/pdb-type-server-valid-signature.yaml b/lld/test/COFF/Inputs/pdb-type-server-valid-signature.yaml --- a/lld/test/COFF/Inputs/pdb-type-server-valid-signature.yaml +++ b/lld/test/COFF/Inputs/pdb-type-server-valid-signature.yaml @@ -68,7 +68,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{8DABD2A0-28FF-CB43-9BAF-175B77B76414}' + Guid: '{A0D2AB8D-FF28-43CB-9BAF-175B77B76414}' Age: 18 Name: 'pdb-diff-cl.pdb' - Name: '.text$mn' diff --git a/lld/test/COFF/pdb-type-server-invalid-signature.yaml b/lld/test/COFF/pdb-type-server-invalid-signature.yaml --- a/lld/test/COFF/pdb-type-server-invalid-signature.yaml +++ b/lld/test/COFF/pdb-type-server-invalid-signature.yaml @@ -95,7 +95,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' + Guid: '{1B19DF01-BF22-426B-96CE-5258B8329FE5}' Age: 18 Name: 'pdb-diff-cl.pdb' - Name: '.text$mn' diff --git a/lld/test/COFF/pdb-type-server-missing.yaml b/lld/test/COFF/pdb-type-server-missing.yaml --- a/lld/test/COFF/pdb-type-server-missing.yaml +++ b/lld/test/COFF/pdb-type-server-missing.yaml @@ -92,7 +92,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' + Guid: '{1B19DF01-BF22-426B-96CE-5258B8329FE5}' Age: 18 Name: 'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb' - Name: '.text$mn' diff --git a/lld/test/COFF/pdb-type-server-native-errors.yaml b/lld/test/COFF/pdb-type-server-native-errors.yaml --- a/lld/test/COFF/pdb-type-server-native-errors.yaml +++ b/lld/test/COFF/pdb-type-server-native-errors.yaml @@ -77,7 +77,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' + Guid: '{1B19DF01-BF22-426B-96CE-5258B8329FE5}' Age: 18 Name: 'bad-block-size.pdb' - Name: '.text$mn' diff --git a/llvm/lib/DebugInfo/CodeView/Formatters.cpp b/llvm/lib/DebugInfo/CodeView/Formatters.cpp --- a/llvm/lib/DebugInfo/CodeView/Formatters.cpp +++ b/llvm/lib/DebugInfo/CodeView/Formatters.cpp @@ -24,20 +24,21 @@ : FormatAdapter(std::move(Guid)) {} void GuidAdapter::format(raw_ostream &Stream, StringRef Style) { - static const char *Lookup = "0123456789ABCDEF"; - assert(Item.size() == 16 && "Expected 16-byte GUID"); - Stream << "{"; - for (int i = 0; i < 16;) { - uint8_t Byte = Item[i]; - uint8_t HighNibble = (Byte >> 4) & 0xF; - uint8_t LowNibble = Byte & 0xF; - Stream << Lookup[HighNibble] << Lookup[LowNibble]; - ++i; - if (i >= 4 && i <= 10 && i % 2 == 0) - Stream << "-"; - } - Stream << "}"; + struct MSGuid { + support::ulittle32_t Data1; + support::ulittle16_t Data2; + support::ulittle16_t Data3; + support::ubig64_t Data4; + }; + const MSGuid *G = reinterpret_cast(Item.data()); + Stream + << '{' << format_hex_no_prefix(G->Data1, sizeof(G->Data1), /*Upper=*/true) + << '-' << format_hex_no_prefix(G->Data2, sizeof(G->Data2), /*Upper=*/true) + << '-' << format_hex_no_prefix(G->Data3, sizeof(G->Data3), /*Upper=*/true) + << '-' << format_hex_no_prefix(G->Data4 >> 48, 2, /*Upper=*/true) << '-' + << format_hex_no_prefix(G->Data4 & ((1ULL << 48) - 1), 6, /*Upper=*/true) + << '}'; } raw_ostream &llvm::codeview::operator<<(raw_ostream &OS, const GUID &Guid) { diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp --- a/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp +++ b/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp @@ -148,23 +148,28 @@ StringRef ScalarTraits::input(StringRef Scalar, void *Ctx, GUID &S) { if (Scalar.size() != 38) return "GUID strings are 38 characters long"; - if (Scalar[0] != '{' || Scalar[37] != '}') + if (Scalar.front() != '{' || Scalar.back() != '}') return "GUID is not enclosed in {}"; - if (Scalar[9] != '-' || Scalar[14] != '-' || Scalar[19] != '-' || - Scalar[24] != '-') + Scalar = Scalar.substr(1, Scalar.size() - 2); + SmallVector A; + Scalar.split(A, '-', 5); + if (A.size() != 5 || Scalar[8] != '-' || Scalar[13] != '-' || + Scalar[18] != '-' || Scalar[23] != '-') return "GUID sections are not properly delineated with dashes"; - - uint8_t *OutBuffer = S.Guid; - for (auto Iter = Scalar.begin(); Iter != Scalar.end();) { - if (*Iter == '-' || *Iter == '{' || *Iter == '}') { - ++Iter; - continue; - } - uint8_t Value = (llvm::hexDigitValue(*Iter++) << 4); - Value |= llvm::hexDigitValue(*Iter++); - *OutBuffer++ = Value; - } - + struct MSGuid { + support::ulittle32_t Data1; + support::ulittle16_t Data2; + support::ulittle16_t Data3; + support::ubig64_t Data4; + }; + MSGuid G = {}; + uint64_t D41{}, D42{}; + if (!to_integer(A[0], G.Data1, 16) || !to_integer(A[1], G.Data2, 16) || + !to_integer(A[2], G.Data3, 16) || !to_integer(A[3], D41, 16) || + !to_integer(A[4], D42, 16)) + return "GUID contains non hex digits"; + G.Data4 = (D41 << 48) | D42; + ::memcpy(&S, &G, sizeof(GUID)); return ""; } diff --git a/llvm/test/DebugInfo/PDB/DIA/pdbdump-flags.test b/llvm/test/DebugInfo/PDB/DIA/pdbdump-flags.test --- a/llvm/test/DebugInfo/PDB/DIA/pdbdump-flags.test +++ b/llvm/test/DebugInfo/PDB/DIA/pdbdump-flags.test @@ -5,7 +5,7 @@ ; Check that neither symbols nor compilands are dumped when neither argument specified. ; NO_ARGS: empty.pdb -; NO_ARGS: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +; NO_ARGS: Guid: {4156350B-A086-49A2-896F-9988FAE52FF0} ; NO_ARGS: Attributes: HasPrivateSymbols ; NO_ARGS-NOT: ---TYPES--- ; NO_ARGS-NOT: ---COMPILANDS--- @@ -14,7 +14,7 @@ ; Check that only types are dumped when only -types is specified. ; TYPES: empty.pdb -; TYPES: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +; TYPES: Guid: {4156350B-A086-49A2-896F-9988FAE52FF0} ; TYPES: Attributes: HasPrivateSymbols ; TYPES: ---TYPES--- ; TYPES-NOT: ---COMPILANDS--- @@ -23,7 +23,7 @@ ; Check that only compilands are dumped when only -compilands is specified. ; COMPILANDS: empty.pdb -; COMPILANDS: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +; COMPILANDS: Guid: {4156350B-A086-49A2-896F-9988FAE52FF0} ; COMPILANDS: Attributes: HasPrivateSymbols ; COMPILANDS: ---COMPILANDS--- ; COMPILANDS-NOT: ---TYPES--- @@ -32,7 +32,7 @@ ; Check that types and compilands are dumped when both arguments are specified. ; MULTIPLE: empty.pdb -; MULTIPLE: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +; MULTIPLE: Guid: {4156350B-A086-49A2-896F-9988FAE52FF0} ; MULTIPLE: Attributes: HasPrivateSymbols ; MULTIPLE: ---COMPILANDS--- ; MULTIPLE: ---TYPES--- diff --git a/llvm/test/DebugInfo/PDB/Native/pdb-native-summary.test b/llvm/test/DebugInfo/PDB/Native/pdb-native-summary.test --- a/llvm/test/DebugInfo/PDB/Native/pdb-native-summary.test +++ b/llvm/test/DebugInfo/PDB/Native/pdb-native-summary.test @@ -6,6 +6,6 @@ ; `-native` option produces identical output. ; EMPTY: Size: 102400 bytes -; EMPTY: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +; EMPTY: Guid: {4156350B-A086-49A2-896F-9988FAE52FF0} ; EMPTY: Age: 1 ; EMPTY: Attributes: HasPrivateSymbols diff --git a/llvm/test/DebugInfo/PDB/pdbdump-headers.test b/llvm/test/DebugInfo/PDB/pdbdump-headers.test --- a/llvm/test/DebugInfo/PDB/pdbdump-headers.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-headers.test @@ -12,7 +12,7 @@ ALL-NEXT: Number of streams: 17 ALL-NEXT: Signature: 1424295906 ALL-NEXT: Age: 1 -ALL-NEXT: GUID: {0B355641-86A0-A249-896F-9988FAE52FF0} +ALL-NEXT: GUID: {4156350B-A086-49A2-896F-9988FAE52FF0} ALL-NEXT: Features: 0x1 ALL-NEXT: Has Debug Info: true ALL-NEXT: Has Types: true @@ -601,7 +601,7 @@ BIG-NEXT: Number of streams: 64 BIG-NEXT: Signature: 1461714535 BIG-NEXT: Age: 1 -BIG-NEXT: GUID: {880ECC89-DF81-0B4F-839C-58CBD052E937} +BIG-NEXT: GUID: {89CC0E88-81DF-4F0B-839C-58CBD052E937} BIG-NEXT: Features: 0x1 BIG-NEXT: Has Debug Info: true BIG-NEXT: Has Types: true diff --git a/llvm/test/DebugInfo/PDB/pdbdump-readwrite.test b/llvm/test/DebugInfo/PDB/pdbdump-readwrite.test --- a/llvm/test/DebugInfo/PDB/pdbdump-readwrite.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-readwrite.test @@ -14,7 +14,7 @@ CHECK-NEXT: Number of streams: CHECK-NEXT: Signature: 1424295906 CHECK-NEXT: Age: 1 -CHECK-NEXT: GUID: {0B355641-86A0-A249-896F-9988FAE52FF0} +CHECK-NEXT: GUID: {4156350B-A086-49A2-896F-9988FAE52FF0} CHECK-NEXT: Features: 0x1 CHECK-NEXT: Has Debug Info: true CHECK-NEXT: Has Types: true diff --git a/llvm/test/DebugInfo/PDB/pdbdump-yaml.test b/llvm/test/DebugInfo/PDB/pdbdump-yaml.test --- a/llvm/test/DebugInfo/PDB/pdbdump-yaml.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-yaml.test @@ -42,7 +42,7 @@ ; YAML-NEXT: - '$T0 $ebp = $eip $T0 4 + ^ = $ebp $T0 ^ = $esp $T0 8 + = ' ; YAML-NEXT: PdbStream: ; YAML-NEXT: Age: 1 -; YAML-NEXT: Guid: '{0B355641-86A0-A249-896F-9988FAE52FF0}' +; YAML-NEXT: Guid: '{4156350B-A086-49A2-896F-9988FAE52FF0}' ; YAML-NEXT: Signature: 1424295906 ; YAML-NEXT: Features: [ VC110 ] ; YAML-NEXT: Version: VC70 diff --git a/llvm/test/ObjectYAML/CodeView/sections.yaml b/llvm/test/ObjectYAML/CodeView/sections.yaml --- a/llvm/test/ObjectYAML/CodeView/sections.yaml +++ b/llvm/test/ObjectYAML/CodeView/sections.yaml @@ -13,7 +13,7 @@ Types: - Kind: LF_TYPESERVER2 TypeServer2: - Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' + Guid: '{1B19DF01-BF22-426B-96CE-5258B8329FE5}' Age: 24 Name: 'C:\src\llvm-project\build\vc140.pdb' - Name: '.debug$H' @@ -66,7 +66,7 @@ # CHECK: Types: # CHECK: - Kind: LF_TYPESERVER2 # CHECK: TypeServer2: -# CHECK: Guid: '{01DF191B-22BF-6B42-96CE-5258B8329FE5}' +# CHECK: Guid: '{1B19DF01-BF22-426B-96CE-5258B8329FE5}' # CHECK: Age: 24 # CHECK: Name: 'C:\src\llvm-project\build\vc140.pdb' # CHECK: - Name: '.debug$H' diff --git a/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test b/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test --- a/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test +++ b/llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test @@ -39,7 +39,7 @@ CHECK-NEXT: Within the PDB stream: CHECK-NEXT: address is at offset 12/28 of the PDB Stream Header. CHECK-NEXT: which contains the guid of the PDB. -CHECK-NEXT: The current value is {826BE46E-02ED-7043-9C27-20CCC07E92A7}. +CHECK-NEXT: The current value is {6EE46B82-ED02-4370-9C27-20CCC07E92A7}. CHECK: Block:Offset = 11:001C. CHECK-NEXT: Address is in block 17 (allocated). diff --git a/llvm/test/tools/llvm-pdbutil/stripped.test b/llvm/test/tools/llvm-pdbutil/stripped.test --- a/llvm/test/tools/llvm-pdbutil/stripped.test +++ b/llvm/test/tools/llvm-pdbutil/stripped.test @@ -8,7 +8,7 @@ ; CHECK-NEXT: Number of streams: 12 ; CHECK-NEXT: Signature: 1541179274 ; CHECK-NEXT: Age: 2 -; CHECK-NEXT: GUID: {FF4F9B62-D99A-4647-97A7-22C702B1E053} +; CHECK-NEXT: GUID: {629B4FFF-9AD9-4746-97A7-22C702B1E053} ; CHECK-NEXT: Features: 0x1 ; CHECK-NEXT: Has Debug Info: true ; CHECK-NEXT: Has Types: true