diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/llvm12/include/llvm/TextAPI | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/TextAPI')
10 files changed, 1154 insertions, 1154 deletions
diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.def b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.def index 2fcae3b28d..9cd27929b4 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.def +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.def @@ -1,39 +1,39 @@ -//===- llvm/TextAPI/MachO/Architecture.def - Architecture -----------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef ARCHINFO -#define ARCHINFO(arch) -#endif - -/// -/// X86 architectures sorted by cpu type and sub type id. -/// -ARCHINFO(i386, MachO::CPU_TYPE_I386, MachO::CPU_SUBTYPE_I386_ALL, 32) -ARCHINFO(x86_64, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_ALL, 64) -ARCHINFO(x86_64h, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_H, 64) - - -/// -/// ARM architectures sorted by cpu sub type id. -/// -ARCHINFO(armv4t, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V4T, 32) -ARCHINFO(armv6, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6, 32) -ARCHINFO(armv5, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V5TEJ, 32) -ARCHINFO(armv7, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7, 32) -ARCHINFO(armv7s, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7S, 32) -ARCHINFO(armv7k, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7K, 32) -ARCHINFO(armv6m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6M, 32) -ARCHINFO(armv7m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7M, 32) -ARCHINFO(armv7em, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7EM, 32) - - -/// -/// ARM64 architectures sorted by cpu sub type id. -/// -ARCHINFO(arm64, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64_ALL, 64) -ARCHINFO(arm64e, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64E, 64) +//===- llvm/TextAPI/MachO/Architecture.def - Architecture -----------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef ARCHINFO +#define ARCHINFO(arch) +#endif + +/// +/// X86 architectures sorted by cpu type and sub type id. +/// +ARCHINFO(i386, MachO::CPU_TYPE_I386, MachO::CPU_SUBTYPE_I386_ALL, 32) +ARCHINFO(x86_64, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_ALL, 64) +ARCHINFO(x86_64h, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_H, 64) + + +/// +/// ARM architectures sorted by cpu sub type id. +/// +ARCHINFO(armv4t, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V4T, 32) +ARCHINFO(armv6, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6, 32) +ARCHINFO(armv5, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V5TEJ, 32) +ARCHINFO(armv7, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7, 32) +ARCHINFO(armv7s, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7S, 32) +ARCHINFO(armv7k, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7K, 32) +ARCHINFO(armv6m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6M, 32) +ARCHINFO(armv7m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7M, 32) +ARCHINFO(armv7em, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7EM, 32) + + +/// +/// ARM64 architectures sorted by cpu sub type id. +/// +ARCHINFO(arm64, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64_ALL, 64) +ARCHINFO(arm64e, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64E, 64) diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.h index 4be62a537a..afbaf6e464 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Architecture.h @@ -1,68 +1,68 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/MachO/Architecture.h - Architecture ---------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// Defines the architecture enum and helper methods. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_ARCHITECTURE_H -#define LLVM_TEXTAPI_MACHO_ARCHITECTURE_H - -#include <cstdint> -#include <utility> - -namespace llvm { -class raw_ostream; -class StringRef; -class Triple; - -namespace MachO { - -/// Defines the architecture slices that are supported by Text-based Stub files. -enum Architecture : uint8_t { -#define ARCHINFO(Arch, Type, SubType, NumBits) AK_##Arch, -#include "llvm/TextAPI/MachO/Architecture.def" -#undef ARCHINFO - AK_unknown, // this has to go last. -}; - -/// Convert a CPU Type and Subtype pair to an architecture slice. -Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType); - -/// Convert a name to an architecture slice. -Architecture getArchitectureFromName(StringRef Name); - -/// Convert an architecture slice to a string. -StringRef getArchitectureName(Architecture Arch); - -/// Convert an architecture slice to a CPU Type and Subtype pair. -std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch); - -/// Convert a target to an architecture slice. -Architecture mapToArchitecture(const llvm::Triple &Target); - -/// Check if architecture is 64 bit. -bool is64Bit(Architecture); - -raw_ostream &operator<<(raw_ostream &OS, Architecture Arch); - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_ARCHITECTURE_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/MachO/Architecture.h - Architecture ---------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Defines the architecture enum and helper methods. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_ARCHITECTURE_H +#define LLVM_TEXTAPI_MACHO_ARCHITECTURE_H + +#include <cstdint> +#include <utility> + +namespace llvm { +class raw_ostream; +class StringRef; +class Triple; + +namespace MachO { + +/// Defines the architecture slices that are supported by Text-based Stub files. +enum Architecture : uint8_t { +#define ARCHINFO(Arch, Type, SubType, NumBits) AK_##Arch, +#include "llvm/TextAPI/MachO/Architecture.def" +#undef ARCHINFO + AK_unknown, // this has to go last. +}; + +/// Convert a CPU Type and Subtype pair to an architecture slice. +Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType); + +/// Convert a name to an architecture slice. +Architecture getArchitectureFromName(StringRef Name); + +/// Convert an architecture slice to a string. +StringRef getArchitectureName(Architecture Arch); + +/// Convert an architecture slice to a CPU Type and Subtype pair. +std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch); + +/// Convert a target to an architecture slice. +Architecture mapToArchitecture(const llvm::Triple &Target); + +/// Check if architecture is 64 bit. +bool is64Bit(Architecture); + +raw_ostream &operator<<(raw_ostream &OS, Architecture Arch); + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_ARCHITECTURE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/ArchitectureSet.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/ArchitectureSet.h index 38057611ba..81ae0b3172 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/ArchitectureSet.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/ArchitectureSet.h @@ -1,177 +1,177 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/MachO/ArchitectureSet.h - ArchitectureSet ---*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// Defines the architecture set. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_ARCHITECTURE_SET_H -#define LLVM_TEXTAPI_MACHO_ARCHITECTURE_SET_H - -#include "llvm/TextAPI/MachO/Architecture.h" -#include <cstddef> -#include <iterator> -#include <limits> -#include <string> -#include <tuple> -#include <vector> - -namespace llvm { -class raw_ostream; - -namespace MachO { - -class ArchitectureSet { -private: - using ArchSetType = uint32_t; - - const static ArchSetType EndIndexVal = - std::numeric_limits<ArchSetType>::max(); - ArchSetType ArchSet{0}; - -public: - constexpr ArchitectureSet() = default; - constexpr ArchitectureSet(ArchSetType Raw) : ArchSet(Raw) {} - ArchitectureSet(Architecture Arch) : ArchitectureSet() { set(Arch); } - ArchitectureSet(const std::vector<Architecture> &Archs); - - void set(Architecture Arch) { - if (Arch == AK_unknown) - return; - ArchSet |= 1U << static_cast<int>(Arch); - } - - void clear(Architecture Arch) { ArchSet &= ~(1U << static_cast<int>(Arch)); } - - bool has(Architecture Arch) const { - return ArchSet & (1U << static_cast<int>(Arch)); - } - - bool contains(ArchitectureSet Archs) const { - return (ArchSet & Archs.ArchSet) == Archs.ArchSet; - } - - size_t count() const; - - bool empty() const { return ArchSet == 0; } - - ArchSetType rawValue() const { return ArchSet; } - - bool hasX86() const { - return has(AK_i386) || has(AK_x86_64) || has(AK_x86_64h); - } - - template <typename Ty> - class arch_iterator - : public std::iterator<std::forward_iterator_tag, Architecture, size_t> { - private: - ArchSetType Index; - Ty *ArchSet; - - void findNextSetBit() { - if (Index == EndIndexVal) - return; - while (++Index < sizeof(Ty) * 8) { - if (*ArchSet & (1UL << Index)) - return; - } - - Index = EndIndexVal; - } - - public: - arch_iterator(Ty *ArchSet, ArchSetType Index = 0) - : Index(Index), ArchSet(ArchSet) { - if (Index != EndIndexVal && !(*ArchSet & (1UL << Index))) - findNextSetBit(); - } - - Architecture operator*() const { return static_cast<Architecture>(Index); } - - arch_iterator &operator++() { - findNextSetBit(); - return *this; - } - - arch_iterator operator++(int) { - auto tmp = *this; - findNextSetBit(); - return tmp; - } - - bool operator==(const arch_iterator &o) const { - return std::tie(Index, ArchSet) == std::tie(o.Index, o.ArchSet); - } - - bool operator!=(const arch_iterator &o) const { return !(*this == o); } - }; - - ArchitectureSet operator&(const ArchitectureSet &o) { - return {ArchSet & o.ArchSet}; - } - - ArchitectureSet operator|(const ArchitectureSet &o) { - return {ArchSet | o.ArchSet}; - } - - ArchitectureSet &operator|=(const ArchitectureSet &o) { - ArchSet |= o.ArchSet; - return *this; - } - - ArchitectureSet &operator|=(const Architecture &Arch) { - set(Arch); - return *this; - } - - bool operator==(const ArchitectureSet &o) const { - return ArchSet == o.ArchSet; - } - - bool operator!=(const ArchitectureSet &o) const { - return ArchSet != o.ArchSet; - } - - bool operator<(const ArchitectureSet &o) const { return ArchSet < o.ArchSet; } - - using iterator = arch_iterator<ArchSetType>; - using const_iterator = arch_iterator<const ArchSetType>; - - iterator begin() { return {&ArchSet}; } - iterator end() { return {&ArchSet, EndIndexVal}; } - - const_iterator begin() const { return {&ArchSet}; } - const_iterator end() const { return {&ArchSet, EndIndexVal}; } - - operator std::string() const; - operator std::vector<Architecture>() const; - void print(raw_ostream &OS) const; -}; - -inline ArchitectureSet operator|(const Architecture &lhs, - const Architecture &rhs) { - return ArchitectureSet(lhs) | ArchitectureSet(rhs); -} - -raw_ostream &operator<<(raw_ostream &OS, ArchitectureSet Set); - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_ARCHITECTURE_SET_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/MachO/ArchitectureSet.h - ArchitectureSet ---*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Defines the architecture set. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_ARCHITECTURE_SET_H +#define LLVM_TEXTAPI_MACHO_ARCHITECTURE_SET_H + +#include "llvm/TextAPI/MachO/Architecture.h" +#include <cstddef> +#include <iterator> +#include <limits> +#include <string> +#include <tuple> +#include <vector> + +namespace llvm { +class raw_ostream; + +namespace MachO { + +class ArchitectureSet { +private: + using ArchSetType = uint32_t; + + const static ArchSetType EndIndexVal = + std::numeric_limits<ArchSetType>::max(); + ArchSetType ArchSet{0}; + +public: + constexpr ArchitectureSet() = default; + constexpr ArchitectureSet(ArchSetType Raw) : ArchSet(Raw) {} + ArchitectureSet(Architecture Arch) : ArchitectureSet() { set(Arch); } + ArchitectureSet(const std::vector<Architecture> &Archs); + + void set(Architecture Arch) { + if (Arch == AK_unknown) + return; + ArchSet |= 1U << static_cast<int>(Arch); + } + + void clear(Architecture Arch) { ArchSet &= ~(1U << static_cast<int>(Arch)); } + + bool has(Architecture Arch) const { + return ArchSet & (1U << static_cast<int>(Arch)); + } + + bool contains(ArchitectureSet Archs) const { + return (ArchSet & Archs.ArchSet) == Archs.ArchSet; + } + + size_t count() const; + + bool empty() const { return ArchSet == 0; } + + ArchSetType rawValue() const { return ArchSet; } + + bool hasX86() const { + return has(AK_i386) || has(AK_x86_64) || has(AK_x86_64h); + } + + template <typename Ty> + class arch_iterator + : public std::iterator<std::forward_iterator_tag, Architecture, size_t> { + private: + ArchSetType Index; + Ty *ArchSet; + + void findNextSetBit() { + if (Index == EndIndexVal) + return; + while (++Index < sizeof(Ty) * 8) { + if (*ArchSet & (1UL << Index)) + return; + } + + Index = EndIndexVal; + } + + public: + arch_iterator(Ty *ArchSet, ArchSetType Index = 0) + : Index(Index), ArchSet(ArchSet) { + if (Index != EndIndexVal && !(*ArchSet & (1UL << Index))) + findNextSetBit(); + } + + Architecture operator*() const { return static_cast<Architecture>(Index); } + + arch_iterator &operator++() { + findNextSetBit(); + return *this; + } + + arch_iterator operator++(int) { + auto tmp = *this; + findNextSetBit(); + return tmp; + } + + bool operator==(const arch_iterator &o) const { + return std::tie(Index, ArchSet) == std::tie(o.Index, o.ArchSet); + } + + bool operator!=(const arch_iterator &o) const { return !(*this == o); } + }; + + ArchitectureSet operator&(const ArchitectureSet &o) { + return {ArchSet & o.ArchSet}; + } + + ArchitectureSet operator|(const ArchitectureSet &o) { + return {ArchSet | o.ArchSet}; + } + + ArchitectureSet &operator|=(const ArchitectureSet &o) { + ArchSet |= o.ArchSet; + return *this; + } + + ArchitectureSet &operator|=(const Architecture &Arch) { + set(Arch); + return *this; + } + + bool operator==(const ArchitectureSet &o) const { + return ArchSet == o.ArchSet; + } + + bool operator!=(const ArchitectureSet &o) const { + return ArchSet != o.ArchSet; + } + + bool operator<(const ArchitectureSet &o) const { return ArchSet < o.ArchSet; } + + using iterator = arch_iterator<ArchSetType>; + using const_iterator = arch_iterator<const ArchSetType>; + + iterator begin() { return {&ArchSet}; } + iterator end() { return {&ArchSet, EndIndexVal}; } + + const_iterator begin() const { return {&ArchSet}; } + const_iterator end() const { return {&ArchSet, EndIndexVal}; } + + operator std::string() const; + operator std::vector<Architecture>() const; + void print(raw_ostream &OS) const; +}; + +inline ArchitectureSet operator|(const Architecture &lhs, + const Architecture &rhs) { + return ArchitectureSet(lhs) | ArchitectureSet(rhs); +} + +raw_ostream &operator<<(raw_ostream &OS, ArchitectureSet Set); + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_ARCHITECTURE_SET_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/InterfaceFile.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/InterfaceFile.h index 4724f8e8e7..fc621fb42a 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/InterfaceFile.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/InterfaceFile.h @@ -1,444 +1,444 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/MachO/IntefaceFile.h - TAPI Interface File --*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// A generic and abstract interface representation for linkable objects. This -// could be an MachO executable, bundle, dylib, or text-based stub file. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_INTERFACE_FILE_H -#define LLVM_TEXTAPI_MACHO_INTERFACE_FILE_H - -#include "llvm/ADT/BitmaskEnum.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/Hashing.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/ADT/iterator.h" -#include "llvm/BinaryFormat/MachO.h" -#include "llvm/BinaryFormat/Magic.h" -#include "llvm/Support/Allocator.h" -#include "llvm/Support/Error.h" -#include "llvm/TextAPI/MachO/Architecture.h" -#include "llvm/TextAPI/MachO/ArchitectureSet.h" -#include "llvm/TextAPI/MachO/PackedVersion.h" -#include "llvm/TextAPI/MachO/Platform.h" -#include "llvm/TextAPI/MachO/Symbol.h" -#include "llvm/TextAPI/MachO/Target.h" - -namespace llvm { -namespace MachO { - -/// Defines a list of Objective-C constraints. -enum class ObjCConstraintType : unsigned { - /// No constraint. - None = 0, - - /// Retain/Release. - Retain_Release = 1, - - /// Retain/Release for Simulator. - Retain_Release_For_Simulator = 2, - - /// Retain/Release or Garbage Collection. - Retain_Release_Or_GC = 3, - - /// Garbage Collection. - GC = 4, -}; - -// clang-format off - -/// Defines the file type this file represents. -enum FileType : unsigned { - /// Invalid file type. - Invalid = 0U, - - /// Text-based stub file (.tbd) version 1.0 - TBD_V1 = 1U << 0, - - /// Text-based stub file (.tbd) version 2.0 - TBD_V2 = 1U << 1, - - /// Text-based stub file (.tbd) version 3.0 - TBD_V3 = 1U << 2, - - /// Text-based stub file (.tbd) version 4.0 - TBD_V4 = 1U << 3, - - All = ~0U, - - LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/All), -}; - -// clang-format on - -/// Reference to an interface file. -class InterfaceFileRef { -public: - InterfaceFileRef() = default; - - InterfaceFileRef(StringRef InstallName) : InstallName(InstallName) {} - - InterfaceFileRef(StringRef InstallName, const TargetList Targets) - : InstallName(InstallName), Targets(std::move(Targets)) {} - - StringRef getInstallName() const { return InstallName; }; - - void addTarget(const Target &Target); - template <typename RangeT> void addTargets(RangeT &&Targets) { - for (const auto &Target : Targets) - addTarget(Target(Target)); - } - - using const_target_iterator = TargetList::const_iterator; - using const_target_range = llvm::iterator_range<const_target_iterator>; - const_target_range targets() const { return {Targets}; } - - ArchitectureSet getArchitectures() const { - return mapToArchitectureSet(Targets); - } - - PlatformSet getPlatforms() const { return mapToPlatformSet(Targets); } - - bool operator==(const InterfaceFileRef &O) const { - return std::tie(InstallName, Targets) == std::tie(O.InstallName, O.Targets); - } - - bool operator!=(const InterfaceFileRef &O) const { - return std::tie(InstallName, Targets) != std::tie(O.InstallName, O.Targets); - } - - bool operator<(const InterfaceFileRef &O) const { - return std::tie(InstallName, Targets) < std::tie(O.InstallName, O.Targets); - } - -private: - std::string InstallName; - TargetList Targets; -}; - -} // end namespace MachO. - -struct SymbolsMapKey { - MachO::SymbolKind Kind; - StringRef Name; - - SymbolsMapKey(MachO::SymbolKind Kind, StringRef Name) - : Kind(Kind), Name(Name) {} -}; -template <> struct DenseMapInfo<SymbolsMapKey> { - static inline SymbolsMapKey getEmptyKey() { - return SymbolsMapKey(MachO::SymbolKind::GlobalSymbol, StringRef{}); - } - - static inline SymbolsMapKey getTombstoneKey() { - return SymbolsMapKey(MachO::SymbolKind::ObjectiveCInstanceVariable, - StringRef{}); - } - - static unsigned getHashValue(const SymbolsMapKey &Key) { - return hash_combine(hash_value(Key.Kind), hash_value(Key.Name)); - } - - static bool isEqual(const SymbolsMapKey &LHS, const SymbolsMapKey &RHS) { - return std::tie(LHS.Kind, LHS.Name) == std::tie(RHS.Kind, RHS.Name); - } -}; - -namespace MachO { - -/// Defines the interface file. -class InterfaceFile { -public: - /// Set the path from which this file was generated (if applicable). - /// - /// \param Path_ The path to the source file. - void setPath(StringRef Path_) { Path = std::string(Path_); } - - /// Get the path from which this file was generated (if applicable). - /// - /// \return The path to the source file or empty. - StringRef getPath() const { return Path; } - - /// Set the file type. - /// - /// This is used by the YAML writer to identify the specification it should - /// use for writing the file. - /// - /// \param Kind The file type. - void setFileType(FileType Kind) { FileKind = Kind; } - - /// Get the file type. - /// - /// \return The file type. - FileType getFileType() const { return FileKind; } - - /// Get the architectures. - /// - /// \return The applicable architectures. - ArchitectureSet getArchitectures() const { - return mapToArchitectureSet(Targets); - } - - /// Get the platforms. - /// - /// \return The applicable platforms. - PlatformSet getPlatforms() const { return mapToPlatformSet(Targets); } - - /// Set and add target. - /// - /// \param Target the target to add into. - void addTarget(const Target &Target); - - /// Set and add targets. - /// - /// Add the subset of llvm::triples that is supported by Tapi - /// - /// \param Targets the collection of targets. - template <typename RangeT> void addTargets(RangeT &&Targets) { - for (const auto &Target_ : Targets) - addTarget(Target(Target_)); - } - - using const_target_iterator = TargetList::const_iterator; - using const_target_range = llvm::iterator_range<const_target_iterator>; - const_target_range targets() const { return {Targets}; } - - using const_filtered_target_iterator = - llvm::filter_iterator<const_target_iterator, - std::function<bool(const Target &)>>; - using const_filtered_target_range = - llvm::iterator_range<const_filtered_target_iterator>; - const_filtered_target_range targets(ArchitectureSet Archs) const; - - /// Set the install name of the library. - void setInstallName(StringRef InstallName_) { - InstallName = std::string(InstallName_); - } - - /// Get the install name of the library. - StringRef getInstallName() const { return InstallName; } - - /// Set the current version of the library. - void setCurrentVersion(PackedVersion Version) { CurrentVersion = Version; } - - /// Get the current version of the library. - PackedVersion getCurrentVersion() const { return CurrentVersion; } - - /// Set the compatibility version of the library. - void setCompatibilityVersion(PackedVersion Version) { - CompatibilityVersion = Version; - } - - /// Get the compatibility version of the library. - PackedVersion getCompatibilityVersion() const { return CompatibilityVersion; } - - /// Set the Swift ABI version of the library. - void setSwiftABIVersion(uint8_t Version) { SwiftABIVersion = Version; } - - /// Get the Swift ABI version of the library. - uint8_t getSwiftABIVersion() const { return SwiftABIVersion; } - - /// Specify if the library uses two-level namespace (or flat namespace). - void setTwoLevelNamespace(bool V = true) { IsTwoLevelNamespace = V; } - - /// Check if the library uses two-level namespace. - bool isTwoLevelNamespace() const { return IsTwoLevelNamespace; } - - /// Specify if the library is application extension safe (or not). - void setApplicationExtensionSafe(bool V = true) { IsAppExtensionSafe = V; } - - /// Check if the library is application extension safe. - bool isApplicationExtensionSafe() const { return IsAppExtensionSafe; } - - /// Set the Objective-C constraint. - void setObjCConstraint(ObjCConstraintType Constraint) { - ObjcConstraint = Constraint; - } - - /// Get the Objective-C constraint. - ObjCConstraintType getObjCConstraint() const { return ObjcConstraint; } - - /// Specify if this file was generated during InstallAPI (or not). - void setInstallAPI(bool V = true) { IsInstallAPI = V; } - - /// Check if this file was generated during InstallAPI. - bool isInstallAPI() const { return IsInstallAPI; } - - /// Set the parent umbrella frameworks. - /// \param Target_ The target applicable to Parent - /// \param Parent The name of Parent - void addParentUmbrella(const Target &Target_, StringRef Parent); - - /// Get the list of Parent Umbrella frameworks. - /// - /// \return Returns a list of target information and install name of parent - /// umbrellas. - const std::vector<std::pair<Target, std::string>> &umbrellas() const { - return ParentUmbrellas; - } - - /// Add an allowable client. - /// - /// Mach-O Dynamic libraries have the concept of allowable clients that are - /// checked during static link time. The name of the application or library - /// that is being generated needs to match one of the allowable clients or the - /// linker refuses to link this library. - /// - /// \param InstallName The name of the client that is allowed to link this library. - /// \param Target The target triple for which this applies. - void addAllowableClient(StringRef InstallName, const Target &Target); - - /// Get the list of allowable clients. - /// - /// \return Returns a list of allowable clients. - const std::vector<InterfaceFileRef> &allowableClients() const { - return AllowableClients; - } - - /// Add a re-exported library. - /// - /// \param InstallName The name of the library to re-export. - /// \param Target The target triple for which this applies. - void addReexportedLibrary(StringRef InstallName, const Target &Target); - - /// Get the list of re-exported libraries. - /// - /// \return Returns a list of re-exported libraries. - const std::vector<InterfaceFileRef> &reexportedLibraries() const { - return ReexportedLibraries; - } - - /// Add an Target/UUID pair. - /// - /// \param Target The target triple for which this applies. - /// \param UUID The UUID of the library for the specified architecture. - void addUUID(const Target &Target, StringRef UUID); - - /// Add an Target/UUID pair. - /// - /// \param Target The target triple for which this applies. - /// \param UUID The UUID of the library for the specified architecture. - void addUUID(const Target &Target, uint8_t UUID[16]); - - /// Get the list of Target/UUID pairs. - /// - /// \return Returns a list of Target/UUID pairs. - const std::vector<std::pair<Target, std::string>> &uuids() const { - return UUIDs; - } - - /// Add a library for inlining to top level library. - /// - ///\param Document The library to inline with top level library. - void addDocument(std::shared_ptr<InterfaceFile> &&Document) { - Documents.emplace_back(std::move(Document)); - } - - /// Get the list of inlined libraries. - /// - /// \return Returns a list of the inlined frameworks. - const std::vector<std::shared_ptr<InterfaceFile>> &documents() const { - return Documents; - } - - /// Add a symbol to the symbols list or extend an existing one. - void addSymbol(SymbolKind Kind, StringRef Name, const TargetList &Targets, - SymbolFlags Flags = SymbolFlags::None); - - using SymbolMapType = DenseMap<SymbolsMapKey, Symbol *>; - struct const_symbol_iterator - : public iterator_adaptor_base< - const_symbol_iterator, SymbolMapType::const_iterator, - std::forward_iterator_tag, const Symbol *, ptrdiff_t, - const Symbol *, const Symbol *> { - const_symbol_iterator() = default; - - template <typename U> - const_symbol_iterator(U &&u) - : iterator_adaptor_base(std::forward<U &&>(u)) {} - - reference operator*() const { return I->second; } - pointer operator->() const { return I->second; } - }; - - using const_symbol_range = iterator_range<const_symbol_iterator>; - - using const_filtered_symbol_iterator = - filter_iterator<const_symbol_iterator, - std::function<bool(const Symbol *)>>; - using const_filtered_symbol_range = - iterator_range<const_filtered_symbol_iterator>; - - const_symbol_range symbols() const { - return {Symbols.begin(), Symbols.end()}; - } - - const_filtered_symbol_range exports() const { - std::function<bool(const Symbol *)> fn = [](const Symbol *Symbol) { - return !Symbol->isUndefined(); - }; - return make_filter_range( - make_range<const_symbol_iterator>({Symbols.begin()}, {Symbols.end()}), - fn); - } - - const_filtered_symbol_range undefineds() const { - std::function<bool(const Symbol *)> fn = [](const Symbol *Symbol) { - return Symbol->isUndefined(); - }; - return make_filter_range( - make_range<const_symbol_iterator>({Symbols.begin()}, {Symbols.end()}), - fn); - } - -private: - llvm::BumpPtrAllocator Allocator; - StringRef copyString(StringRef String) { - if (String.empty()) - return {}; - - void *Ptr = Allocator.Allocate(String.size(), 1); - memcpy(Ptr, String.data(), String.size()); - return StringRef(reinterpret_cast<const char *>(Ptr), String.size()); - } - - TargetList Targets; - std::string Path; - FileType FileKind; - std::string InstallName; - PackedVersion CurrentVersion; - PackedVersion CompatibilityVersion; - uint8_t SwiftABIVersion{0}; - bool IsTwoLevelNamespace{false}; - bool IsAppExtensionSafe{false}; - bool IsInstallAPI{false}; - ObjCConstraintType ObjcConstraint = ObjCConstraintType::None; - std::vector<std::pair<Target, std::string>> ParentUmbrellas; - std::vector<InterfaceFileRef> AllowableClients; - std::vector<InterfaceFileRef> ReexportedLibraries; - std::vector<std::shared_ptr<InterfaceFile>> Documents; - std::vector<std::pair<Target, std::string>> UUIDs; - SymbolMapType Symbols; -}; - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_INTERFACE_FILE_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/MachO/IntefaceFile.h - TAPI Interface File --*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// A generic and abstract interface representation for linkable objects. This +// could be an MachO executable, bundle, dylib, or text-based stub file. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_INTERFACE_FILE_H +#define LLVM_TEXTAPI_MACHO_INTERFACE_FILE_H + +#include "llvm/ADT/BitmaskEnum.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/iterator.h" +#include "llvm/BinaryFormat/MachO.h" +#include "llvm/BinaryFormat/Magic.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/Error.h" +#include "llvm/TextAPI/MachO/Architecture.h" +#include "llvm/TextAPI/MachO/ArchitectureSet.h" +#include "llvm/TextAPI/MachO/PackedVersion.h" +#include "llvm/TextAPI/MachO/Platform.h" +#include "llvm/TextAPI/MachO/Symbol.h" +#include "llvm/TextAPI/MachO/Target.h" + +namespace llvm { +namespace MachO { + +/// Defines a list of Objective-C constraints. +enum class ObjCConstraintType : unsigned { + /// No constraint. + None = 0, + + /// Retain/Release. + Retain_Release = 1, + + /// Retain/Release for Simulator. + Retain_Release_For_Simulator = 2, + + /// Retain/Release or Garbage Collection. + Retain_Release_Or_GC = 3, + + /// Garbage Collection. + GC = 4, +}; + +// clang-format off + +/// Defines the file type this file represents. +enum FileType : unsigned { + /// Invalid file type. + Invalid = 0U, + + /// Text-based stub file (.tbd) version 1.0 + TBD_V1 = 1U << 0, + + /// Text-based stub file (.tbd) version 2.0 + TBD_V2 = 1U << 1, + + /// Text-based stub file (.tbd) version 3.0 + TBD_V3 = 1U << 2, + + /// Text-based stub file (.tbd) version 4.0 + TBD_V4 = 1U << 3, + + All = ~0U, + + LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/All), +}; + +// clang-format on + +/// Reference to an interface file. +class InterfaceFileRef { +public: + InterfaceFileRef() = default; + + InterfaceFileRef(StringRef InstallName) : InstallName(InstallName) {} + + InterfaceFileRef(StringRef InstallName, const TargetList Targets) + : InstallName(InstallName), Targets(std::move(Targets)) {} + + StringRef getInstallName() const { return InstallName; }; + + void addTarget(const Target &Target); + template <typename RangeT> void addTargets(RangeT &&Targets) { + for (const auto &Target : Targets) + addTarget(Target(Target)); + } + + using const_target_iterator = TargetList::const_iterator; + using const_target_range = llvm::iterator_range<const_target_iterator>; + const_target_range targets() const { return {Targets}; } + + ArchitectureSet getArchitectures() const { + return mapToArchitectureSet(Targets); + } + + PlatformSet getPlatforms() const { return mapToPlatformSet(Targets); } + + bool operator==(const InterfaceFileRef &O) const { + return std::tie(InstallName, Targets) == std::tie(O.InstallName, O.Targets); + } + + bool operator!=(const InterfaceFileRef &O) const { + return std::tie(InstallName, Targets) != std::tie(O.InstallName, O.Targets); + } + + bool operator<(const InterfaceFileRef &O) const { + return std::tie(InstallName, Targets) < std::tie(O.InstallName, O.Targets); + } + +private: + std::string InstallName; + TargetList Targets; +}; + +} // end namespace MachO. + +struct SymbolsMapKey { + MachO::SymbolKind Kind; + StringRef Name; + + SymbolsMapKey(MachO::SymbolKind Kind, StringRef Name) + : Kind(Kind), Name(Name) {} +}; +template <> struct DenseMapInfo<SymbolsMapKey> { + static inline SymbolsMapKey getEmptyKey() { + return SymbolsMapKey(MachO::SymbolKind::GlobalSymbol, StringRef{}); + } + + static inline SymbolsMapKey getTombstoneKey() { + return SymbolsMapKey(MachO::SymbolKind::ObjectiveCInstanceVariable, + StringRef{}); + } + + static unsigned getHashValue(const SymbolsMapKey &Key) { + return hash_combine(hash_value(Key.Kind), hash_value(Key.Name)); + } + + static bool isEqual(const SymbolsMapKey &LHS, const SymbolsMapKey &RHS) { + return std::tie(LHS.Kind, LHS.Name) == std::tie(RHS.Kind, RHS.Name); + } +}; + +namespace MachO { + +/// Defines the interface file. +class InterfaceFile { +public: + /// Set the path from which this file was generated (if applicable). + /// + /// \param Path_ The path to the source file. + void setPath(StringRef Path_) { Path = std::string(Path_); } + + /// Get the path from which this file was generated (if applicable). + /// + /// \return The path to the source file or empty. + StringRef getPath() const { return Path; } + + /// Set the file type. + /// + /// This is used by the YAML writer to identify the specification it should + /// use for writing the file. + /// + /// \param Kind The file type. + void setFileType(FileType Kind) { FileKind = Kind; } + + /// Get the file type. + /// + /// \return The file type. + FileType getFileType() const { return FileKind; } + + /// Get the architectures. + /// + /// \return The applicable architectures. + ArchitectureSet getArchitectures() const { + return mapToArchitectureSet(Targets); + } + + /// Get the platforms. + /// + /// \return The applicable platforms. + PlatformSet getPlatforms() const { return mapToPlatformSet(Targets); } + + /// Set and add target. + /// + /// \param Target the target to add into. + void addTarget(const Target &Target); + + /// Set and add targets. + /// + /// Add the subset of llvm::triples that is supported by Tapi + /// + /// \param Targets the collection of targets. + template <typename RangeT> void addTargets(RangeT &&Targets) { + for (const auto &Target_ : Targets) + addTarget(Target(Target_)); + } + + using const_target_iterator = TargetList::const_iterator; + using const_target_range = llvm::iterator_range<const_target_iterator>; + const_target_range targets() const { return {Targets}; } + + using const_filtered_target_iterator = + llvm::filter_iterator<const_target_iterator, + std::function<bool(const Target &)>>; + using const_filtered_target_range = + llvm::iterator_range<const_filtered_target_iterator>; + const_filtered_target_range targets(ArchitectureSet Archs) const; + + /// Set the install name of the library. + void setInstallName(StringRef InstallName_) { + InstallName = std::string(InstallName_); + } + + /// Get the install name of the library. + StringRef getInstallName() const { return InstallName; } + + /// Set the current version of the library. + void setCurrentVersion(PackedVersion Version) { CurrentVersion = Version; } + + /// Get the current version of the library. + PackedVersion getCurrentVersion() const { return CurrentVersion; } + + /// Set the compatibility version of the library. + void setCompatibilityVersion(PackedVersion Version) { + CompatibilityVersion = Version; + } + + /// Get the compatibility version of the library. + PackedVersion getCompatibilityVersion() const { return CompatibilityVersion; } + + /// Set the Swift ABI version of the library. + void setSwiftABIVersion(uint8_t Version) { SwiftABIVersion = Version; } + + /// Get the Swift ABI version of the library. + uint8_t getSwiftABIVersion() const { return SwiftABIVersion; } + + /// Specify if the library uses two-level namespace (or flat namespace). + void setTwoLevelNamespace(bool V = true) { IsTwoLevelNamespace = V; } + + /// Check if the library uses two-level namespace. + bool isTwoLevelNamespace() const { return IsTwoLevelNamespace; } + + /// Specify if the library is application extension safe (or not). + void setApplicationExtensionSafe(bool V = true) { IsAppExtensionSafe = V; } + + /// Check if the library is application extension safe. + bool isApplicationExtensionSafe() const { return IsAppExtensionSafe; } + + /// Set the Objective-C constraint. + void setObjCConstraint(ObjCConstraintType Constraint) { + ObjcConstraint = Constraint; + } + + /// Get the Objective-C constraint. + ObjCConstraintType getObjCConstraint() const { return ObjcConstraint; } + + /// Specify if this file was generated during InstallAPI (or not). + void setInstallAPI(bool V = true) { IsInstallAPI = V; } + + /// Check if this file was generated during InstallAPI. + bool isInstallAPI() const { return IsInstallAPI; } + + /// Set the parent umbrella frameworks. + /// \param Target_ The target applicable to Parent + /// \param Parent The name of Parent + void addParentUmbrella(const Target &Target_, StringRef Parent); + + /// Get the list of Parent Umbrella frameworks. + /// + /// \return Returns a list of target information and install name of parent + /// umbrellas. + const std::vector<std::pair<Target, std::string>> &umbrellas() const { + return ParentUmbrellas; + } + + /// Add an allowable client. + /// + /// Mach-O Dynamic libraries have the concept of allowable clients that are + /// checked during static link time. The name of the application or library + /// that is being generated needs to match one of the allowable clients or the + /// linker refuses to link this library. + /// + /// \param InstallName The name of the client that is allowed to link this library. + /// \param Target The target triple for which this applies. + void addAllowableClient(StringRef InstallName, const Target &Target); + + /// Get the list of allowable clients. + /// + /// \return Returns a list of allowable clients. + const std::vector<InterfaceFileRef> &allowableClients() const { + return AllowableClients; + } + + /// Add a re-exported library. + /// + /// \param InstallName The name of the library to re-export. + /// \param Target The target triple for which this applies. + void addReexportedLibrary(StringRef InstallName, const Target &Target); + + /// Get the list of re-exported libraries. + /// + /// \return Returns a list of re-exported libraries. + const std::vector<InterfaceFileRef> &reexportedLibraries() const { + return ReexportedLibraries; + } + + /// Add an Target/UUID pair. + /// + /// \param Target The target triple for which this applies. + /// \param UUID The UUID of the library for the specified architecture. + void addUUID(const Target &Target, StringRef UUID); + + /// Add an Target/UUID pair. + /// + /// \param Target The target triple for which this applies. + /// \param UUID The UUID of the library for the specified architecture. + void addUUID(const Target &Target, uint8_t UUID[16]); + + /// Get the list of Target/UUID pairs. + /// + /// \return Returns a list of Target/UUID pairs. + const std::vector<std::pair<Target, std::string>> &uuids() const { + return UUIDs; + } + + /// Add a library for inlining to top level library. + /// + ///\param Document The library to inline with top level library. + void addDocument(std::shared_ptr<InterfaceFile> &&Document) { + Documents.emplace_back(std::move(Document)); + } + + /// Get the list of inlined libraries. + /// + /// \return Returns a list of the inlined frameworks. + const std::vector<std::shared_ptr<InterfaceFile>> &documents() const { + return Documents; + } + + /// Add a symbol to the symbols list or extend an existing one. + void addSymbol(SymbolKind Kind, StringRef Name, const TargetList &Targets, + SymbolFlags Flags = SymbolFlags::None); + + using SymbolMapType = DenseMap<SymbolsMapKey, Symbol *>; + struct const_symbol_iterator + : public iterator_adaptor_base< + const_symbol_iterator, SymbolMapType::const_iterator, + std::forward_iterator_tag, const Symbol *, ptrdiff_t, + const Symbol *, const Symbol *> { + const_symbol_iterator() = default; + + template <typename U> + const_symbol_iterator(U &&u) + : iterator_adaptor_base(std::forward<U &&>(u)) {} + + reference operator*() const { return I->second; } + pointer operator->() const { return I->second; } + }; + + using const_symbol_range = iterator_range<const_symbol_iterator>; + + using const_filtered_symbol_iterator = + filter_iterator<const_symbol_iterator, + std::function<bool(const Symbol *)>>; + using const_filtered_symbol_range = + iterator_range<const_filtered_symbol_iterator>; + + const_symbol_range symbols() const { + return {Symbols.begin(), Symbols.end()}; + } + + const_filtered_symbol_range exports() const { + std::function<bool(const Symbol *)> fn = [](const Symbol *Symbol) { + return !Symbol->isUndefined(); + }; + return make_filter_range( + make_range<const_symbol_iterator>({Symbols.begin()}, {Symbols.end()}), + fn); + } + + const_filtered_symbol_range undefineds() const { + std::function<bool(const Symbol *)> fn = [](const Symbol *Symbol) { + return Symbol->isUndefined(); + }; + return make_filter_range( + make_range<const_symbol_iterator>({Symbols.begin()}, {Symbols.end()}), + fn); + } + +private: + llvm::BumpPtrAllocator Allocator; + StringRef copyString(StringRef String) { + if (String.empty()) + return {}; + + void *Ptr = Allocator.Allocate(String.size(), 1); + memcpy(Ptr, String.data(), String.size()); + return StringRef(reinterpret_cast<const char *>(Ptr), String.size()); + } + + TargetList Targets; + std::string Path; + FileType FileKind; + std::string InstallName; + PackedVersion CurrentVersion; + PackedVersion CompatibilityVersion; + uint8_t SwiftABIVersion{0}; + bool IsTwoLevelNamespace{false}; + bool IsAppExtensionSafe{false}; + bool IsInstallAPI{false}; + ObjCConstraintType ObjcConstraint = ObjCConstraintType::None; + std::vector<std::pair<Target, std::string>> ParentUmbrellas; + std::vector<InterfaceFileRef> AllowableClients; + std::vector<InterfaceFileRef> ReexportedLibraries; + std::vector<std::shared_ptr<InterfaceFile>> Documents; + std::vector<std::pair<Target, std::string>> UUIDs; + SymbolMapType Symbols; +}; + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_INTERFACE_FILE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/PackedVersion.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/PackedVersion.h index 1ffc4e1e6d..a393d261a9 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/PackedVersion.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/PackedVersion.h @@ -1,78 +1,78 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/MachO/PackedVersion.h - PackedVersion -------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// Defines the Mach-O packed version format. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_PACKED_VERSION_H -#define LLVM_TEXTAPI_MACHO_PACKED_VERSION_H - -#include <cstdint> -#include <utility> - -namespace llvm { -class raw_ostream; -class StringRef; - -namespace MachO { - -class PackedVersion { - uint32_t Version{0}; - -public: - constexpr PackedVersion() = default; - explicit constexpr PackedVersion(uint32_t RawVersion) : Version(RawVersion) {} - PackedVersion(unsigned Major, unsigned Minor, unsigned Subminor) - : Version((Major << 16) | ((Minor & 0xff) << 8) | (Subminor & 0xff)) {} - - bool empty() const { return Version == 0; } - - /// Retrieve the major version number. - unsigned getMajor() const { return Version >> 16; } - - /// Retrieve the minor version number, if provided. - unsigned getMinor() const { return (Version >> 8) & 0xff; } - - /// Retrieve the subminor version number, if provided. - unsigned getSubminor() const { return Version & 0xff; } - - bool parse32(StringRef Str); - std::pair<bool, bool> parse64(StringRef Str); - - bool operator<(const PackedVersion &O) const { return Version < O.Version; } - - bool operator==(const PackedVersion &O) const { return Version == O.Version; } - - bool operator!=(const PackedVersion &O) const { return Version != O.Version; } - - uint32_t rawValue() const { return Version; } - - void print(raw_ostream &OS) const; -}; - -inline raw_ostream &operator<<(raw_ostream &OS, const PackedVersion &Version) { - Version.print(OS); - return OS; -} - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_PACKED_VERSION_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/MachO/PackedVersion.h - PackedVersion -------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Defines the Mach-O packed version format. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_PACKED_VERSION_H +#define LLVM_TEXTAPI_MACHO_PACKED_VERSION_H + +#include <cstdint> +#include <utility> + +namespace llvm { +class raw_ostream; +class StringRef; + +namespace MachO { + +class PackedVersion { + uint32_t Version{0}; + +public: + constexpr PackedVersion() = default; + explicit constexpr PackedVersion(uint32_t RawVersion) : Version(RawVersion) {} + PackedVersion(unsigned Major, unsigned Minor, unsigned Subminor) + : Version((Major << 16) | ((Minor & 0xff) << 8) | (Subminor & 0xff)) {} + + bool empty() const { return Version == 0; } + + /// Retrieve the major version number. + unsigned getMajor() const { return Version >> 16; } + + /// Retrieve the minor version number, if provided. + unsigned getMinor() const { return (Version >> 8) & 0xff; } + + /// Retrieve the subminor version number, if provided. + unsigned getSubminor() const { return Version & 0xff; } + + bool parse32(StringRef Str); + std::pair<bool, bool> parse64(StringRef Str); + + bool operator<(const PackedVersion &O) const { return Version < O.Version; } + + bool operator==(const PackedVersion &O) const { return Version == O.Version; } + + bool operator!=(const PackedVersion &O) const { return Version != O.Version; } + + uint32_t rawValue() const { return Version; } + + void print(raw_ostream &OS) const; +}; + +inline raw_ostream &operator<<(raw_ostream &OS, const PackedVersion &Version) { + Version.print(OS); + return OS; +} + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_PACKED_VERSION_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Platform.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Platform.h index 80708443b1..fa88aee174 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Platform.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Platform.h @@ -1,57 +1,57 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/MachO/Platform.h - Platform -----------------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// Defines the Platforms supported by Tapi and helpers. -// -//===----------------------------------------------------------------------===// -#ifndef LLVM_TEXTAPI_MACHO_PLATFORM_H -#define LLVM_TEXTAPI_MACHO_PLATFORM_H - -#include "llvm/ADT/SmallSet.h" -#include "llvm/BinaryFormat/MachO.h" - -namespace llvm { -namespace MachO { - -/// Defines the list of MachO platforms. -enum class PlatformKind : unsigned { - unknown, - macOS = MachO::PLATFORM_MACOS, - iOS = MachO::PLATFORM_IOS, - tvOS = MachO::PLATFORM_TVOS, - watchOS = MachO::PLATFORM_WATCHOS, - bridgeOS = MachO::PLATFORM_BRIDGEOS, - macCatalyst = MachO::PLATFORM_MACCATALYST, - iOSSimulator = MachO::PLATFORM_IOSSIMULATOR, - tvOSSimulator = MachO::PLATFORM_TVOSSIMULATOR, +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/MachO/Platform.h - Platform -----------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Defines the Platforms supported by Tapi and helpers. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_TEXTAPI_MACHO_PLATFORM_H +#define LLVM_TEXTAPI_MACHO_PLATFORM_H + +#include "llvm/ADT/SmallSet.h" +#include "llvm/BinaryFormat/MachO.h" + +namespace llvm { +namespace MachO { + +/// Defines the list of MachO platforms. +enum class PlatformKind : unsigned { + unknown, + macOS = MachO::PLATFORM_MACOS, + iOS = MachO::PLATFORM_IOS, + tvOS = MachO::PLATFORM_TVOS, + watchOS = MachO::PLATFORM_WATCHOS, + bridgeOS = MachO::PLATFORM_BRIDGEOS, + macCatalyst = MachO::PLATFORM_MACCATALYST, + iOSSimulator = MachO::PLATFORM_IOSSIMULATOR, + tvOSSimulator = MachO::PLATFORM_TVOSSIMULATOR, watchOSSimulator = MachO::PLATFORM_WATCHOSSIMULATOR, driverKit = MachO::PLATFORM_DRIVERKIT, -}; - -using PlatformSet = SmallSet<PlatformKind, 3>; - -PlatformKind mapToPlatformKind(PlatformKind Platform, bool WantSim); -PlatformKind mapToPlatformKind(const Triple &Target); -PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets); -StringRef getPlatformName(PlatformKind Platform); - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_PLATFORM_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +}; + +using PlatformSet = SmallSet<PlatformKind, 3>; + +PlatformKind mapToPlatformKind(PlatformKind Platform, bool WantSim); +PlatformKind mapToPlatformKind(const Triple &Target); +PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets); +StringRef getPlatformName(PlatformKind Platform); + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_PLATFORM_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Symbol.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Symbol.h index 1803b2d5eb..6d4391b4a5 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Symbol.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Symbol.h @@ -1,128 +1,128 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/Symbol.h - TAPI Symbol ----------------------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_SYMBOL_H -#define LLVM_TEXTAPI_MACHO_SYMBOL_H - -#include "llvm/ADT/BitmaskEnum.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/TextAPI/MachO/ArchitectureSet.h" -#include "llvm/TextAPI/MachO/Target.h" - -namespace llvm { -namespace MachO { - -// clang-format off - -/// Symbol flags. -enum class SymbolFlags : uint8_t { - /// No flags - None = 0, - - /// Thread-local value symbol - ThreadLocalValue = 1U << 0, - - /// Weak defined symbol - WeakDefined = 1U << 1, - - /// Weak referenced symbol - WeakReferenced = 1U << 2, - - /// Undefined - Undefined = 1U << 3, - - /// Rexported - Rexported = 1U << 4, - - LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Rexported), -}; - -// clang-format on - -enum class SymbolKind : uint8_t { - GlobalSymbol, - ObjectiveCClass, - ObjectiveCClassEHType, - ObjectiveCInstanceVariable, -}; - -using TargetList = SmallVector<Target, 5>; -class Symbol { -public: - Symbol(SymbolKind Kind, StringRef Name, TargetList Targets, SymbolFlags Flags) - : Name(Name), Targets(std::move(Targets)), Kind(Kind), Flags(Flags) {} - - void addTarget(Target target) { Targets.emplace_back(target); } - SymbolKind getKind() const { return Kind; } - StringRef getName() const { return Name; } - ArchitectureSet getArchitectures() const { - return mapToArchitectureSet(Targets); - } - SymbolFlags getFlags() const { return Flags; } - - bool isWeakDefined() const { - return (Flags & SymbolFlags::WeakDefined) == SymbolFlags::WeakDefined; - } - - bool isWeakReferenced() const { - return (Flags & SymbolFlags::WeakReferenced) == SymbolFlags::WeakReferenced; - } - - bool isThreadLocalValue() const { - return (Flags & SymbolFlags::ThreadLocalValue) == - SymbolFlags::ThreadLocalValue; - } - - bool isUndefined() const { - return (Flags & SymbolFlags::Undefined) == SymbolFlags::Undefined; - } - - bool isReexported() const { - return (Flags & SymbolFlags::Rexported) == SymbolFlags::Rexported; - } - - using const_target_iterator = TargetList::const_iterator; - using const_target_range = llvm::iterator_range<const_target_iterator>; - const_target_range targets() const { return {Targets}; } - - using const_filtered_target_iterator = - llvm::filter_iterator<const_target_iterator, - std::function<bool(const Target &)>>; - using const_filtered_target_range = - llvm::iterator_range<const_filtered_target_iterator>; - const_filtered_target_range targets(ArchitectureSet architectures) const; - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump(raw_ostream &OS) const; - void dump() const { dump(llvm::errs()); } -#endif - -private: - StringRef Name; - TargetList Targets; - SymbolKind Kind; - SymbolFlags Flags; -}; - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_SYMBOL_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/Symbol.h - TAPI Symbol ----------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_SYMBOL_H +#define LLVM_TEXTAPI_MACHO_SYMBOL_H + +#include "llvm/ADT/BitmaskEnum.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/TextAPI/MachO/ArchitectureSet.h" +#include "llvm/TextAPI/MachO/Target.h" + +namespace llvm { +namespace MachO { + +// clang-format off + +/// Symbol flags. +enum class SymbolFlags : uint8_t { + /// No flags + None = 0, + + /// Thread-local value symbol + ThreadLocalValue = 1U << 0, + + /// Weak defined symbol + WeakDefined = 1U << 1, + + /// Weak referenced symbol + WeakReferenced = 1U << 2, + + /// Undefined + Undefined = 1U << 3, + + /// Rexported + Rexported = 1U << 4, + + LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Rexported), +}; + +// clang-format on + +enum class SymbolKind : uint8_t { + GlobalSymbol, + ObjectiveCClass, + ObjectiveCClassEHType, + ObjectiveCInstanceVariable, +}; + +using TargetList = SmallVector<Target, 5>; +class Symbol { +public: + Symbol(SymbolKind Kind, StringRef Name, TargetList Targets, SymbolFlags Flags) + : Name(Name), Targets(std::move(Targets)), Kind(Kind), Flags(Flags) {} + + void addTarget(Target target) { Targets.emplace_back(target); } + SymbolKind getKind() const { return Kind; } + StringRef getName() const { return Name; } + ArchitectureSet getArchitectures() const { + return mapToArchitectureSet(Targets); + } + SymbolFlags getFlags() const { return Flags; } + + bool isWeakDefined() const { + return (Flags & SymbolFlags::WeakDefined) == SymbolFlags::WeakDefined; + } + + bool isWeakReferenced() const { + return (Flags & SymbolFlags::WeakReferenced) == SymbolFlags::WeakReferenced; + } + + bool isThreadLocalValue() const { + return (Flags & SymbolFlags::ThreadLocalValue) == + SymbolFlags::ThreadLocalValue; + } + + bool isUndefined() const { + return (Flags & SymbolFlags::Undefined) == SymbolFlags::Undefined; + } + + bool isReexported() const { + return (Flags & SymbolFlags::Rexported) == SymbolFlags::Rexported; + } + + using const_target_iterator = TargetList::const_iterator; + using const_target_range = llvm::iterator_range<const_target_iterator>; + const_target_range targets() const { return {Targets}; } + + using const_filtered_target_iterator = + llvm::filter_iterator<const_target_iterator, + std::function<bool(const Target &)>>; + using const_filtered_target_range = + llvm::iterator_range<const_filtered_target_iterator>; + const_filtered_target_range targets(ArchitectureSet architectures) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump(raw_ostream &OS) const; + void dump() const { dump(llvm::errs()); } +#endif + +private: + StringRef Name; + TargetList Targets; + SymbolKind Kind; + SymbolFlags Flags; +}; + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_SYMBOL_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Target.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Target.h index d5ee32a37e..22481358e9 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Target.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/Target.h @@ -1,79 +1,79 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- llvm/TextAPI/Target.h - TAPI Target ----------------------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_TARGET_H -#define LLVM_TEXTAPI_MACHO_TARGET_H - -#include "llvm/ADT/Triple.h" -#include "llvm/Support/Error.h" -#include "llvm/TextAPI/MachO/Architecture.h" -#include "llvm/TextAPI/MachO/ArchitectureSet.h" -#include "llvm/TextAPI/MachO/Platform.h" - -namespace llvm { -namespace MachO { - -// This is similar to a llvm Triple, but the triple doesn't have all the -// information we need. For example there is no enum value for x86_64h. The -// only way to get that information is to parse the triple string. -class Target { -public: - Target() = default; - Target(Architecture Arch, PlatformKind Platform) - : Arch(Arch), Platform(Platform) {} - explicit Target(const llvm::Triple &Triple) - : Arch(mapToArchitecture(Triple)), Platform(mapToPlatformKind(Triple)) {} - - static llvm::Expected<Target> create(StringRef Target); - - operator std::string() const; - - Architecture Arch; - PlatformKind Platform; -}; - -inline bool operator==(const Target &LHS, const Target &RHS) { - return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform); -} - -inline bool operator!=(const Target &LHS, const Target &RHS) { - return std::tie(LHS.Arch, LHS.Platform) != std::tie(RHS.Arch, RHS.Platform); -} - -inline bool operator<(const Target &LHS, const Target &RHS) { - return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform); -} - -inline bool operator==(const Target &LHS, const Architecture &RHS) { - return LHS.Arch == RHS; -} - -inline bool operator!=(const Target &LHS, const Architecture &RHS) { - return LHS.Arch != RHS; -} - -PlatformSet mapToPlatformSet(ArrayRef<Target> Targets); -ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets); - -raw_ostream &operator<<(raw_ostream &OS, const Target &Target); - -} // namespace MachO -} // namespace llvm - -#endif // LLVM_TEXTAPI_MACHO_TARGET_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/TextAPI/Target.h - TAPI Target ----------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_TARGET_H +#define LLVM_TEXTAPI_MACHO_TARGET_H + +#include "llvm/ADT/Triple.h" +#include "llvm/Support/Error.h" +#include "llvm/TextAPI/MachO/Architecture.h" +#include "llvm/TextAPI/MachO/ArchitectureSet.h" +#include "llvm/TextAPI/MachO/Platform.h" + +namespace llvm { +namespace MachO { + +// This is similar to a llvm Triple, but the triple doesn't have all the +// information we need. For example there is no enum value for x86_64h. The +// only way to get that information is to parse the triple string. +class Target { +public: + Target() = default; + Target(Architecture Arch, PlatformKind Platform) + : Arch(Arch), Platform(Platform) {} + explicit Target(const llvm::Triple &Triple) + : Arch(mapToArchitecture(Triple)), Platform(mapToPlatformKind(Triple)) {} + + static llvm::Expected<Target> create(StringRef Target); + + operator std::string() const; + + Architecture Arch; + PlatformKind Platform; +}; + +inline bool operator==(const Target &LHS, const Target &RHS) { + return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform); +} + +inline bool operator!=(const Target &LHS, const Target &RHS) { + return std::tie(LHS.Arch, LHS.Platform) != std::tie(RHS.Arch, RHS.Platform); +} + +inline bool operator<(const Target &LHS, const Target &RHS) { + return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform); +} + +inline bool operator==(const Target &LHS, const Architecture &RHS) { + return LHS.Arch == RHS; +} + +inline bool operator!=(const Target &LHS, const Architecture &RHS) { + return LHS.Arch != RHS; +} + +PlatformSet mapToPlatformSet(ArrayRef<Target> Targets); +ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets); + +raw_ostream &operator<<(raw_ostream &OS, const Target &Target); + +} // namespace MachO +} // namespace llvm + +#endif // LLVM_TEXTAPI_MACHO_TARGET_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIReader.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIReader.h index 84e1afa7a8..e69ec69595 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIReader.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIReader.h @@ -1,44 +1,44 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===--- TextAPIReader.h - Text API Reader ----------------------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_READER_H -#define LLVM_TEXTAPI_MACHO_READER_H - -#include "llvm/Support/Error.h" - -namespace llvm { - -class MemoryBufferRef; - -namespace MachO { - -class InterfaceFile; - -class TextAPIReader { -public: - static Expected<std::unique_ptr<InterfaceFile>> - get(MemoryBufferRef InputBuffer); - - TextAPIReader() = delete; -}; - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_READER_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===--- TextAPIReader.h - Text API Reader ----------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_READER_H +#define LLVM_TEXTAPI_MACHO_READER_H + +#include "llvm/Support/Error.h" + +namespace llvm { + +class MemoryBufferRef; + +namespace MachO { + +class InterfaceFile; + +class TextAPIReader { +public: + static Expected<std::unique_ptr<InterfaceFile>> + get(MemoryBufferRef InputBuffer); + + TextAPIReader() = delete; +}; + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_READER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIWriter.h b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIWriter.h index 247c9b0921..d977357e3a 100644 --- a/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIWriter.h +++ b/contrib/libs/llvm12/include/llvm/TextAPI/MachO/TextAPIWriter.h @@ -1,42 +1,42 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===--- TextAPIWriter.h - Text API Writer ----------------------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TEXTAPI_MACHO_WRITER_H -#define LLVM_TEXTAPI_MACHO_WRITER_H - -namespace llvm { - -class Error; -class raw_ostream; - -namespace MachO { - -class InterfaceFile; - -class TextAPIWriter { -public: - TextAPIWriter() = delete; - - static Error writeToStream(raw_ostream &os, const InterfaceFile &); -}; - -} // end namespace MachO. -} // end namespace llvm. - -#endif // LLVM_TEXTAPI_MACHO_WRITER_H - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===--- TextAPIWriter.h - Text API Writer ----------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_MACHO_WRITER_H +#define LLVM_TEXTAPI_MACHO_WRITER_H + +namespace llvm { + +class Error; +class raw_ostream; + +namespace MachO { + +class InterfaceFile; + +class TextAPIWriter { +public: + TextAPIWriter() = delete; + + static Error writeToStream(raw_ostream &os, const InterfaceFile &); +}; + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_MACHO_WRITER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif |