GUID.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //===- GUID.h ---------------------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_DEBUGINFO_CODEVIEW_GUID_H
  9. #define LLVM_DEBUGINFO_CODEVIEW_GUID_H
  10. #include <cstdint>
  11. #include <cstring>
  12. namespace llvm {
  13. class raw_ostream;
  14. namespace codeview {
  15. /// This represents the 'GUID' type from windows.h.
  16. struct GUID {
  17. uint8_t Guid[16];
  18. };
  19. inline bool operator==(const GUID &LHS, const GUID &RHS) {
  20. return 0 == ::memcmp(LHS.Guid, RHS.Guid, sizeof(LHS.Guid));
  21. }
  22. inline bool operator<(const GUID &LHS, const GUID &RHS) {
  23. return ::memcmp(LHS.Guid, RHS.Guid, sizeof(LHS.Guid)) < 0;
  24. }
  25. inline bool operator<=(const GUID &LHS, const GUID &RHS) {
  26. return ::memcmp(LHS.Guid, RHS.Guid, sizeof(LHS.Guid)) <= 0;
  27. }
  28. inline bool operator>(const GUID &LHS, const GUID &RHS) {
  29. return !(LHS <= RHS);
  30. }
  31. inline bool operator>=(const GUID &LHS, const GUID &RHS) {
  32. return !(LHS < RHS);
  33. }
  34. inline bool operator!=(const GUID &LHS, const GUID &RHS) {
  35. return !(LHS == RHS);
  36. }
  37. raw_ostream &operator<<(raw_ostream &OS, const GUID &Guid);
  38. } // namespace codeview
  39. } // namespace llvm
  40. #endif