//===- Formatters.cpp -----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/DebugInfo/CodeView/Formatters.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/DebugInfo/CodeView/GUID.h" #include "llvm/Support/Endian.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" #include <cassert> usingnamespacellvm; usingnamespacellvm::codeview; usingnamespacellvm::codeview::detail; GuidAdapter::GuidAdapter(StringRef Guid) : … { … } GuidAdapter::GuidAdapter(ArrayRef<uint8_t> Guid) : … { … } // From https://docs.microsoft.com/en-us/windows/win32/msi/guid documentation: // The GUID data type is a text string representing a Class identifier (ID). // All GUIDs must be authored in uppercase. // The valid format for a GUID is {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} where // X is a hex digit (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). // // The individual string components must be padded to comply with the specific // lengths of {8-4-4-4-12} characters. // The llvm-yaml2obj tool checks that a GUID follow that format: // - the total length to be 38 (including the curly braces. // - there is a dash at the positions: 8, 13, 18 and 23. void GuidAdapter::format(raw_ostream &Stream, StringRef Style) { … } raw_ostream &llvm::codeview::operator<<(raw_ostream &OS, const GUID &Guid) { … }