diff options
Diffstat (limited to 'llvm/lib/TextAPI')
-rw-r--r-- | llvm/lib/TextAPI/MachO/TextStub.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/TextAPI/MachO/TextStubCommon.cpp | 41 | ||||
-rw-r--r-- | llvm/lib/TextAPI/MachO/TextStubCommon.h | 6 |
3 files changed, 26 insertions, 25 deletions
diff --git a/llvm/lib/TextAPI/MachO/TextStub.cpp b/llvm/lib/TextAPI/MachO/TextStub.cpp index f46dde6721a..630663d3ea9 100644 --- a/llvm/lib/TextAPI/MachO/TextStub.cpp +++ b/llvm/lib/TextAPI/MachO/TextStub.cpp @@ -515,11 +515,11 @@ template <> struct MappingTraits<const InterfaceFile *> { std::vector<Architecture> Architectures; std::vector<UUID> UUIDs; - PlatformType Platform; + PlatformKind Platform{PlatformKind::unknown}; StringRef InstallName; PackedVersion CurrentVersion; PackedVersion CompatibilityVersion; - SwiftVersion SwiftABIVersion; + SwiftVersion SwiftABIVersion{0}; ObjCConstraintType ObjCConstraint{ObjCConstraintType::None}; TBDFlags Flags{TBDFlags::None}; StringRef ParentUmbrella; diff --git a/llvm/lib/TextAPI/MachO/TextStubCommon.cpp b/llvm/lib/TextAPI/MachO/TextStubCommon.cpp index 6c42d40bfb1..7cbeb710840 100644 --- a/llvm/lib/TextAPI/MachO/TextStubCommon.cpp +++ b/llvm/lib/TextAPI/MachO/TextStubCommon.cpp @@ -43,43 +43,44 @@ void ScalarEnumerationTraits<ObjCConstraintType>::enumeration( IO.enumCase(Constraint, "gc", ObjCConstraintType::GC); } -void ScalarTraits<PlatformType>::output(const PlatformType &Value, void *, +void ScalarTraits<PlatformKind>::output(const PlatformKind &Value, void *, raw_ostream &OS) { switch (Value) { - case PLATFORM_MACOS: + default: + llvm_unreachable("unexpected platform"); + break; + case PlatformKind::macOS: OS << "macosx"; break; - case PLATFORM_IOS: + case PlatformKind::iOS: OS << "ios"; break; - case PLATFORM_WATCHOS: + case PlatformKind::watchOS: OS << "watchos"; break; - case PLATFORM_TVOS: + case PlatformKind::tvOS: OS << "tvos"; break; - case PLATFORM_BRIDGEOS: + case PlatformKind::bridgeOS: OS << "bridgeos"; break; } } -StringRef ScalarTraits<PlatformType>::input(StringRef Scalar, void *, - PlatformType &Value) { - int Result = StringSwitch<unsigned>(Scalar) - .Case("macosx", PLATFORM_MACOS) - .Case("ios", PLATFORM_IOS) - .Case("watchos", PLATFORM_WATCHOS) - .Case("tvos", PLATFORM_TVOS) - .Case("bridgeos", PLATFORM_BRIDGEOS) - .Default(0); - - if (!Result) +StringRef ScalarTraits<PlatformKind>::input(StringRef Scalar, void *, + PlatformKind &Value) { + Value = StringSwitch<PlatformKind>(Scalar) + .Case("macosx", PlatformKind::macOS) + .Case("ios", PlatformKind::iOS) + .Case("watchos", PlatformKind::watchOS) + .Case("tvos", PlatformKind::tvOS) + .Case("bridgeos", PlatformKind::bridgeOS) + .Default(PlatformKind::unknown); + + if (Value == PlatformKind::unknown) return "unknown platform"; - - Value = static_cast<PlatformType>(Result); return {}; } -QuotingType ScalarTraits<PlatformType>::mustQuote(StringRef) { +QuotingType ScalarTraits<PlatformKind>::mustQuote(StringRef) { return QuotingType::None; } diff --git a/llvm/lib/TextAPI/MachO/TextStubCommon.h b/llvm/lib/TextAPI/MachO/TextStubCommon.h index eadd2f52dc5..cd6d49a0191 100644 --- a/llvm/lib/TextAPI/MachO/TextStubCommon.h +++ b/llvm/lib/TextAPI/MachO/TextStubCommon.h @@ -43,9 +43,9 @@ template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> { static void enumeration(IO &, MachO::ObjCConstraintType &); }; -template <> struct ScalarTraits<MachO::PlatformType> { - static void output(const MachO::PlatformType &, void *, raw_ostream &); - static StringRef input(StringRef, void *, MachO::PlatformType &); +template <> struct ScalarTraits<MachO::PlatformKind> { + static void output(const MachO::PlatformKind &, void *, raw_ostream &); + static StringRef input(StringRef, void *, MachO::PlatformKind &); static QuotingType mustQuote(StringRef); }; |