Platform.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //===- llvm/TextAPI/Platform.h - Platform -----------------------*- 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. //
  9. // Defines the Platforms supported by Tapi and helpers.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_TEXTAPI_MACHO_PLATFORM_H
  13. #define LLVM_TEXTAPI_MACHO_PLATFORM_H
  14. #include "llvm/ADT/SmallSet.h"
  15. #include "llvm/BinaryFormat/MachO.h"
  16. namespace llvm {
  17. namespace MachO {
  18. /// Defines the list of MachO platforms.
  19. enum class PlatformKind : unsigned {
  20. unknown,
  21. macOS = MachO::PLATFORM_MACOS,
  22. iOS = MachO::PLATFORM_IOS,
  23. tvOS = MachO::PLATFORM_TVOS,
  24. watchOS = MachO::PLATFORM_WATCHOS,
  25. bridgeOS = MachO::PLATFORM_BRIDGEOS,
  26. macCatalyst = MachO::PLATFORM_MACCATALYST,
  27. iOSSimulator = MachO::PLATFORM_IOSSIMULATOR,
  28. tvOSSimulator = MachO::PLATFORM_TVOSSIMULATOR,
  29. watchOSSimulator = MachO::PLATFORM_WATCHOSSIMULATOR,
  30. driverKit = MachO::PLATFORM_DRIVERKIT,
  31. };
  32. using PlatformSet = SmallSet<PlatformKind, 3>;
  33. PlatformKind mapToPlatformKind(PlatformKind Platform, bool WantSim);
  34. PlatformKind mapToPlatformKind(const Triple &Target);
  35. PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets);
  36. StringRef getPlatformName(PlatformKind Platform);
  37. PlatformKind getPlatformFromName(StringRef Name);
  38. } // end namespace MachO.
  39. } // end namespace llvm.
  40. #endif // LLVM_TEXTAPI_MACHO_PLATFORM_H