diff options
author | Cyndy Ishida <cyndy_ishida@apple.com> | 2019-09-20 14:32:34 +0000 |
---|---|---|
committer | Cyndy Ishida <cyndy_ishida@apple.com> | 2019-09-20 14:32:34 +0000 |
commit | 81669d5ead6fa555f13308771a6d4cd97f9a73c5 (patch) | |
tree | 7ab3adb03b615d52c00acec032b97e6d0d736e38 /llvm/lib/TextAPI/MachO/TextStubCommon.cpp | |
parent | 084801bdc1a798f30d3ecc183009c74809e051c5 (diff) | |
download | llvm-81669d5ead6fa555f13308771a6d4cd97f9a73c5.zip llvm-81669d5ead6fa555f13308771a6d4cd97f9a73c5.tar.gz llvm-81669d5ead6fa555f13308771a6d4cd97f9a73c5.tar.bz2 |
[TextAPI] Arch&Platform to Target
Summary:
This is a patch for updating TextAPI/Macho to read in targets as opposed to arch/platform.
This is because in previous versions tbd files only supported a single platform but that is no longer the case,
so, now its tracked by unique triples.
This precedes a seperate patch that will add the TBD-v4 format
Reviewers: ributzka, steven_wu, plotfi, compnerd, smeenai
Reviewed By: ributzka
Subscribers: mgorny, hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67527
llvm-svn: 372396
Diffstat (limited to 'llvm/lib/TextAPI/MachO/TextStubCommon.cpp')
-rw-r--r-- | llvm/lib/TextAPI/MachO/TextStubCommon.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/llvm/lib/TextAPI/MachO/TextStubCommon.cpp b/llvm/lib/TextAPI/MachO/TextStubCommon.cpp index 00382cd..313b040 100644 --- a/llvm/lib/TextAPI/MachO/TextStubCommon.cpp +++ b/llvm/lib/TextAPI/MachO/TextStubCommon.cpp @@ -41,9 +41,10 @@ void ScalarEnumerationTraits<ObjCConstraintType>::enumeration( IO.enumCase(Constraint, "gc", ObjCConstraintType::GC); } -void ScalarTraits<PlatformKind>::output(const PlatformKind &Value, void *, - raw_ostream &OS) { - switch (Value) { +void ScalarTraits<PlatformSet>::output(const PlatformSet &Values, void *IO, + raw_ostream &OS) { + assert(Values.size() == 1U); + switch (*Values.begin()) { default: llvm_unreachable("unexpected platform"); break; @@ -64,21 +65,26 @@ void ScalarTraits<PlatformKind>::output(const PlatformKind &Value, void *, break; } } -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) + +StringRef ScalarTraits<PlatformSet>::input(StringRef Scalar, void *IO, + PlatformSet &Values) { + auto Platform = StringSwitch<PlatformKind>(Scalar) + .Case("unknown", PlatformKind::unknown) + .Case("macosx", PlatformKind::macOS) + .Case("ios", PlatformKind::iOS) + .Case("watchos", PlatformKind::watchOS) + .Case("tvos", PlatformKind::tvOS) + .Case("bridgeos", PlatformKind::bridgeOS) + .Default(PlatformKind::unknown); + + if (Platform == PlatformKind::unknown) return "unknown platform"; + + Values.insert(Platform); return {}; } -QuotingType ScalarTraits<PlatformKind>::mustQuote(StringRef) { + +QuotingType ScalarTraits<PlatformSet>::mustQuote(StringRef) { return QuotingType::None; } @@ -166,10 +172,11 @@ StringRef ScalarTraits<UUID>::input(StringRef Scalar, void *, UUID &Value) { auto UUID = Split.second.trim(); if (UUID.empty()) return "invalid uuid string pair"; - Value.first = getArchitectureFromName(Arch); Value.second = UUID; + Value.first = Target{getArchitectureFromName(Arch), PlatformKind::unknown}; return {}; } + QuotingType ScalarTraits<UUID>::mustQuote(StringRef) { return QuotingType::Single; } |