GUID.h 1.5 KB

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