82using AttrToTargets = std::map<std::string, TargetList>;
83using TargetsToSymbols =
124std::array<StringRef, 64> Keys = {
136 "compatibility_versions",
144 "reexported_libraries",
148 "reexported_symbols",
163 return {
"invalid ", Keys[
Key],
" section"};
167 return {
"missing ", Keys[
Key],
" information"};
172 JSONStubError(
Twine ErrMsg) : Message(ErrMsg.str()) {}
183template <
typename JsonT,
typename StubT = JsonT>
185 TBDKey Key,
const Object *Obj,
186 std::function<std::optional<JsonT>(
const Object *,
StringRef)> GetValue,
187 std::function<std::optional<StubT>(JsonT)> Validate =
nullptr) {
188 std::optional<JsonT> Val = GetValue(Obj, Keys[Key]);
190 return make_error<JSONStubError>(getParseErrorMsg(Key));
192 if (Validate ==
nullptr)
193 return static_cast<StubT
>(*Val);
195 std::optional<StubT>
Result = Validate(*Val);
197 return make_error<JSONStubError>(getParseErrorMsg(Key));
201template <
typename JsonT,
typename StubT = JsonT>
203 TBDKey Key,
const Object *Obj,
206 StubT DefaultValue,
function_ref<std::optional<StubT>(JsonT)> Validate) {
207 std::optional<JsonT> Val = GetValue(Obj, Keys[Key]);
211 std::optional<StubT>
Result;
214 return make_error<JSONStubError>(getParseErrorMsg(Key));
218Error collectFromArray(TBDKey Key,
const Object *Obj,
220 bool IsRequired =
false) {
221 const auto *Values = Obj->
getArray(Keys[Key]);
224 return make_error<JSONStubError>(getParseErrorMsg(Key));
228 for (
const Value &Val : *Values) {
229 auto ValStr = Val.getAsString();
230 if (!ValStr.has_value())
231 return make_error<JSONStubError>(getParseErrorMsg(Key));
232 Append(ValStr.value());
241 auto VersionOrErr = getRequiredValue<int64_t, FileType>(
243 [](int64_t Val) -> std::optional<FileType> {
244 unsigned Result = Val;
247 return FileType::TBD_V5;
252 return *VersionOrErr;
256 const auto *Targets = Section->getArray(Keys[TBDKey::Targets]);
258 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Targets));
261 for (
const Value &JSONTarget : *Targets) {
262 auto TargetStr = JSONTarget.getAsString();
263 if (!TargetStr.has_value())
264 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
267 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
270 return std::move(IFTargets);
274 const Array *Targets = Section->getArray(Keys[TBDKey::TargetInfo]);
276 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Targets));
279 for (
const Value &JSONTarget : *Targets) {
280 const auto *Obj = JSONTarget.getAsObject();
282 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
286 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
289 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
291 auto VersionStr = Obj->
getString(Keys[TBDKey::Deployment]);
293 if (VersionStr && Version.tryParse(*VersionStr))
294 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Deployment));
295 TargetOrErr->MinDeployment = Version;
302 return std::move(IFTargets);
305Error collectSymbolsFromSegment(
const Object *Segment, TargetsToSymbols &Result,
307 auto Err = collectFromArray(
308 TBDKey::Globals, Segment, [&Result, &SectionFlag](
StringRef Name) {
309 JSONSymbol
Sym = {EncodeKind::GlobalSymbol,
Name.str(), SectionFlag};
310 Result.back().second.emplace_back(
Sym);
315 Err = collectFromArray(
316 TBDKey::ObjCClass, Segment, [&Result, &SectionFlag](
StringRef Name) {
317 JSONSymbol
Sym = {EncodeKind::ObjectiveCClass,
Name.str(), SectionFlag};
318 Result.back().second.emplace_back(
Sym);
323 Err = collectFromArray(TBDKey::ObjCEHType, Segment,
325 JSONSymbol
Sym = {EncodeKind::ObjectiveCClassEHType,
326 Name.str(), SectionFlag};
327 Result.back().second.emplace_back(
Sym);
332 Err = collectFromArray(
333 TBDKey::ObjCIvar, Segment, [&Result, &SectionFlag](
StringRef Name) {
334 JSONSymbol
Sym = {EncodeKind::ObjectiveCInstanceVariable,
Name.str(),
336 Result.back().second.emplace_back(
Sym);
343 (((SectionFlag & SymbolFlags::Undefined) == SymbolFlags::Undefined)
344 ? SymbolFlags::WeakReferenced
345 : SymbolFlags::WeakDefined);
346 Err = collectFromArray(
348 JSONSymbol
Sym = {EncodeKind::GlobalSymbol,
Name.str(), WeakFlag};
349 Result.back().second.emplace_back(
Sym);
354 Err = collectFromArray(
355 TBDKey::ThreadLocal, Segment, [&Result, SectionFlag](
StringRef Name) {
356 JSONSymbol
Sym = {EncodeKind::GlobalSymbol,
Name.str(),
357 SymbolFlags::ThreadLocalValue | SectionFlag};
358 Result.back().second.emplace_back(
Sym);
367 const Array *Section = File->getArray(Keys[TBDKey::InstallName]);
369 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::InstallName));
371 assert(!Section->empty() &&
"unexpected missing install name");
373 const auto *Obj = Section->front().getAsObject();
375 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::InstallName));
383 const Array *Section = File->getArray(Keys[Key]);
385 return TargetsToSymbols();
389 case TBDKey::Reexports:
390 SectionFlag = SymbolFlags::Rexported;
392 case TBDKey::Undefineds:
393 SectionFlag = SymbolFlags::Undefined;
396 SectionFlag = SymbolFlags::None;
400 TargetsToSymbols Result;
402 for (
auto Val : *Section) {
403 auto *Obj = Val.getAsObject();
407 auto TargetsOrErr = getTargets(Obj);
409 MappedTargets = Targets;
412 MappedTargets = *TargetsOrErr;
415 std::make_pair(std::move(MappedTargets), std::vector<JSONSymbol>()));
417 auto *DataSection = Obj->
getObject(Keys[TBDKey::Data]);
418 auto *TextSection = Obj->
getObject(Keys[TBDKey::Text]);
420 if (!DataSection && !TextSection)
421 return make_error<JSONStubError>(getParseErrorMsg(Key));
424 auto Err = collectSymbolsFromSegment(DataSection, Result,
425 SectionFlag | SymbolFlags::Data);
427 return std::move(Err);
430 auto Err = collectSymbolsFromSegment(TextSection, Result,
431 SectionFlag | SymbolFlags::Text);
433 return std::move(Err);
437 return std::move(Result);
443 auto *Section = File->getArray(Keys[Key]);
445 return AttrToTargets();
447 AttrToTargets Result;
449 for (
auto Val : *Section) {
450 auto *Obj = Val.getAsObject();
454 auto TargetsOrErr = getTargets(Obj);
456 MappedTargets = Targets;
459 MappedTargets = *TargetsOrErr;
462 collectFromArray(SubKey, Obj, [&Result, &MappedTargets](
StringRef Key) {
463 Result[Key.str()] = MappedTargets;
466 return std::move(Err);
469 return std::move(Result);
474 const auto *Umbrella = File->getArray(Keys[TBDKey::ParentUmbrella]);
476 return AttrToTargets();
478 AttrToTargets Result;
480 for (
auto Val : *Umbrella) {
481 auto *Obj = Val.getAsObject();
483 return make_error<JSONStubError>(
484 getParseErrorMsg(TBDKey::ParentUmbrella));
487 auto TargetsOrErr = getTargets(Obj);
489 MappedTargets = Targets;
492 MappedTargets = *TargetsOrErr;
498 return UmbrellaOrErr.takeError();
499 Result[UmbrellaOrErr->str()] = Targets;
501 return std::move(Result);
505 const Array *Versions = File->getArray(Keys[TBDKey::SwiftABI]);
509 for (
const auto &Val : *Versions) {
510 const auto *Obj = Val.getAsObject();
512 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::SwiftABI));
515 return getRequiredValue<int64_t, uint8_t>(TBDKey::ABI, Obj,
523 const Array *Versions = File->getArray(Keys[Key]);
527 for (
const auto &Val : *Versions) {
528 const auto *Obj = Val.getAsObject();
530 return make_error<JSONStubError>(getParseErrorMsg(Key));
532 auto ValidatePV = [](
StringRef Version) -> std::optional<PackedVersion> {
540 return getRequiredValue<StringRef, PackedVersion>(
550 const Array *Section = File->getArray(Keys[TBDKey::Flags]);
551 if (!Section || Section->empty())
554 for (
auto &Val : *Section) {
556 const auto *Obj = Val.getAsObject();
558 return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Flags));
561 collectFromArray(TBDKey::Attributes, Obj, [&Flags](
StringRef Flag) {
564 .
Case(
"flat_namespace", TBDFlags::FlatNamespace)
565 .
Case(
"not_app_extension_safe",
566 TBDFlags::NotApplicationExtensionSafe)
567 .
Case(
"sim_support", TBDFlags::SimulatorSupport)
568 .
Case(
"not_for_dyld_shared_cache",
569 TBDFlags::OSLibNotForSharedCache)
575 return std::move(FlagsOrErr);
583using IFPtr = std::unique_ptr<InterfaceFile>;
585 auto TargetsOrErr = getTargetsSection(File);
587 return TargetsOrErr.takeError();
590 auto NameOrErr = getNameSection(File);
592 return NameOrErr.takeError();
595 auto CurrVersionOrErr = getPackedVersion(File, TBDKey::CurrentVersion);
596 if (!CurrVersionOrErr)
597 return CurrVersionOrErr.takeError();
600 auto CompVersionOrErr = getPackedVersion(File, TBDKey::CompatibilityVersion);
601 if (!CompVersionOrErr)
602 return CompVersionOrErr.takeError();
605 auto SwiftABIOrErr = getSwiftVersion(File);
607 return SwiftABIOrErr.takeError();
608 uint8_t SwiftABI = *SwiftABIOrErr;
612 return FlagsOrErr.takeError();
615 auto UmbrellasOrErr = getUmbrellaSection(File, Targets);
617 return UmbrellasOrErr.takeError();
618 AttrToTargets Umbrellas = *UmbrellasOrErr;
621 getLibSection(File, TBDKey::AllowableClients, TBDKey::Clients, Targets);
623 return ClientsOrErr.takeError();
624 AttrToTargets Clients = *ClientsOrErr;
627 getLibSection(File, TBDKey::ReexportLibs, TBDKey::Names, Targets);
629 return RLOrErr.takeError();
630 AttrToTargets ReexportLibs = std::move(*RLOrErr);
632 auto RPathsOrErr = getLibSection(File, TBDKey::RPath, TBDKey::Paths, Targets);
634 return RPathsOrErr.takeError();
635 AttrToTargets RPaths = std::move(*RPathsOrErr);
637 auto ExportsOrErr = getSymbolSection(File, TBDKey::Exports, Targets);
639 return ExportsOrErr.takeError();
640 TargetsToSymbols Exports = std::move(*ExportsOrErr);
642 auto ReexportsOrErr = getSymbolSection(File, TBDKey::Reexports, Targets);
644 return ReexportsOrErr.takeError();
645 TargetsToSymbols Reexports = std::move(*ReexportsOrErr);
647 auto UndefinedsOrErr = getSymbolSection(File, TBDKey::Undefineds, Targets);
648 if (!UndefinedsOrErr)
649 return UndefinedsOrErr.takeError();
650 TargetsToSymbols Undefineds = std::move(*UndefinedsOrErr);
653 F->setInstallName(
Name);
654 F->setCurrentVersion(CurrVersion);
655 F->setCompatibilityVersion(CompVersion);
656 F->setSwiftABIVersion(SwiftABI);
657 F->setTwoLevelNamespace(!(Flags & TBDFlags::FlatNamespace));
658 F->setApplicationExtensionSafe(
659 !(Flags & TBDFlags::NotApplicationExtensionSafe));
660 F->setSimulatorSupport((Flags & TBDFlags::SimulatorSupport));
661 F->setOSLibNotForSharedCache((Flags & TBDFlags::OSLibNotForSharedCache));
662 for (
auto &
T : Targets)
664 for (
auto &[
Lib, Targets] : Clients)
665 for (
auto Target : Targets)
667 for (
auto &[
Lib, Targets] : ReexportLibs)
668 for (
auto Target : Targets)
670 for (
auto &[
Lib, Targets] : Umbrellas)
671 for (
auto Target : Targets)
673 for (
auto &[
Path, Targets] : RPaths)
674 for (
auto Target : Targets)
676 for (
auto &[Targets, Symbols] : Exports)
677 for (
auto &
Sym : Symbols)
678 F->addSymbol(
Sym.Kind,
Sym.Name, Targets,
Sym.Flags);
679 for (
auto &[Targets, Symbols] : Reexports)
680 for (
auto &
Sym : Symbols)
681 F->addSymbol(
Sym.Kind,
Sym.Name, Targets,
Sym.Flags);
682 for (
auto &[Targets, Symbols] : Undefineds)
683 for (
auto &
Sym : Symbols)
684 F->addSymbol(
Sym.Kind,
Sym.Name, Targets,
Sym.Flags);
690 std::vector<IFPtr> IFs;
691 const Array *Files = File->getArray(Keys[TBDKey::Documents]);
693 return std::move(IFs);
695 for (
auto Lib : *Files) {
696 auto IFOrErr = parseToInterfaceFile(
Lib.getAsObject());
698 return IFOrErr.takeError();
699 auto IF = std::move(*IFOrErr);
700 IFs.emplace_back(std::move(IF));
702 return std::move(IFs);
710 auto ValOrErr =
parse(JSON);
712 return ValOrErr.takeError();
714 auto *Root = ValOrErr->getAsObject();
715 auto VersionOrErr = StubParser::getVersion(Root);
717 return VersionOrErr.takeError();
721 auto IFOrErr = StubParser::parseToInterfaceFile(MainLib);
723 return IFOrErr.takeError();
724 (*IFOrErr)->setFileType(Version);
725 std::unique_ptr<InterfaceFile> IF(std::move(*IFOrErr));
727 auto IFsOrErr = StubParser::getInlinedLibs(Root);
729 return IFsOrErr.takeError();
730 for (
auto &File : *IFsOrErr) {
731 File->setFileType(Version);
732 IF->addDocument(std::shared_ptr<InterfaceFile>(std::move(File)));
734 return std::move(IF);
739template <
typename ContainerT = Array>
740bool insertNonEmptyValues(
Object &Obj, TBDKey Key, ContainerT &&Contents) {
741 if (Contents.empty())
743 Obj[Keys[Key]] = std::move(Contents);
748 std::string PlatformStr = Targ.
Platform == PLATFORM_MACCATALYST
754template <
typename AggregateT>
755std::vector<std::string> serializeTargets(
const AggregateT Targets,
757 std::vector<std::string> TargetsStr;
758 if (Targets.size() == ActiveTargets.
size())
762 TargetsStr.emplace_back(getFormattedStr(
Target));
769 for (
const auto Targ : ActiveTargets) {
773 TargetInfo[Keys[TBDKey::Target]] = getFormattedStr(Targ);
779template <
typename ValueT,
typename EntryT = ValueT>
790using TargetsToValuesMap =
791 std::map<std::vector<std::string>, std::vector<std::string>>;
793template <
typename AggregateT = TargetsToValuesMap>
794Array serializeAttrToTargets(AggregateT &Entries, TBDKey Key) {
796 for (
const auto &[Targets, Values] : Entries) {
798 insertNonEmptyValues(Obj, TBDKey::Targets, std::move(Targets));
799 Obj[Keys[
Key]] = Values;
805template <
typename ValueT = std::string,
806 typename AggregateT = std::vector<std::pair<MachO::Target, ValueT>>>
807Array serializeField(TBDKey Key,
const AggregateT &Values,
808 const TargetList &ActiveTargets,
bool IsArray =
true) {
809 std::map<ValueT, std::set<MachO::Target>> Entries;
810 for (
const auto &[
Target, Val] : Values)
811 Entries[Val].insert(
Target);
814 std::map<std::vector<std::string>, std::string> FinalEntries;
815 for (
const auto &[Val, Targets] : Entries)
816 FinalEntries[serializeTargets(Targets, ActiveTargets)] = Val;
817 return serializeAttrToTargets(FinalEntries, Key);
820 TargetsToValuesMap FinalEntries;
821 for (
const auto &[Val, Targets] : Entries)
822 FinalEntries[serializeTargets(Targets, ActiveTargets)].emplace_back(Val);
823 return serializeAttrToTargets(FinalEntries, Key);
826Array serializeField(TBDKey Key,
const std::vector<InterfaceFileRef> &Values,
828 TargetsToValuesMap FinalEntries;
829 for (
const auto &
Ref : Values) {
831 FinalEntries[serializeTargets(Targets, ActiveTargets)].emplace_back(
832 Ref.getInstallName());
834 return serializeAttrToTargets(FinalEntries, Key);
839 std::vector<StringRef> Weaks;
840 std::vector<StringRef> Globals;
841 std::vector<StringRef> TLV;
842 std::vector<StringRef> ObjCClasses;
843 std::vector<StringRef> IVars;
844 std::vector<StringRef> EHTypes;
847 return Weaks.empty() && Globals.empty() && TLV.empty() &&
848 ObjCClasses.empty() && IVars.empty() && EHTypes.empty();
857 auto AssignForSymbolType = [](SymbolFields::SymbolTypes &Assignment,
860 case EncodeKind::ObjectiveCClass:
863 case EncodeKind::ObjectiveCClassEHType:
864 Assignment.EHTypes.emplace_back(
Sym->
getName());
866 case EncodeKind::ObjectiveCInstanceVariable:
867 Assignment.IVars.emplace_back(
Sym->
getName());
869 case EncodeKind::GlobalSymbol: {
871 Assignment.Weaks.emplace_back(
Sym->
getName());
875 Assignment.Globals.emplace_back(
Sym->
getName());
881 std::map<std::vector<std::string>, SymbolFields> Entries;
882 for (
const auto *
Sym : Symbols) {
885 auto JSONTargets = serializeTargets(Targets, ActiveTargets);
887 AssignForSymbolType(Entries[std::move(JSONTargets)].Data,
Sym);
889 AssignForSymbolType(Entries[std::move(JSONTargets)].
Text,
Sym);
894 auto InsertSymbolsToJSON = [](
Object &SymSection, TBDKey SegmentKey,
895 SymbolFields::SymbolTypes &SymField) {
896 if (SymField.empty())
899 insertNonEmptyValues(Segment, TBDKey::Globals, std::move(SymField.Globals));
900 insertNonEmptyValues(Segment, TBDKey::ThreadLocal, std::move(SymField.TLV));
901 insertNonEmptyValues(Segment, TBDKey::Weak, std::move(SymField.Weaks));
902 insertNonEmptyValues(Segment, TBDKey::ObjCClass,
903 std::move(SymField.ObjCClasses));
904 insertNonEmptyValues(Segment, TBDKey::ObjCEHType,
905 std::move(SymField.EHTypes));
906 insertNonEmptyValues(Segment, TBDKey::ObjCIvar, std::move(SymField.IVars));
907 insertNonEmptyValues(SymSection, SegmentKey, std::move(Segment));
911 for (
auto &[Targets, Fields] : Entries) {
913 insertNonEmptyValues(AllSyms, TBDKey::Targets, std::move(Targets));
914 InsertSymbolsToJSON(AllSyms, TBDKey::Data, Fields.Data);
915 InsertSymbolsToJSON(AllSyms, TBDKey::Text, Fields.Text);
919 return SymbolSection;
925 if (!
File->isTwoLevelNamespace())
926 Flags.emplace_back(
"flat_namespace");
927 if (!
File->isApplicationExtensionSafe())
928 Flags.emplace_back(
"not_app_extension_safe");
929 if (
File->hasSimulatorSupport())
930 Flags.emplace_back(
"sim_support");
931 if (
File->isOSLibNotForSharedCache())
932 Flags.emplace_back(
"not_for_dyld_shared_cache");
933 return serializeScalar(TBDKey::Attributes, std::move(Flags));
941 if (!insertNonEmptyValues(Library, TBDKey::TargetInfo,
942 serializeTargetInfo(ActiveTargets)))
943 return make_error<JSONStubError>(getSerializeErrorMsg(TBDKey::TargetInfo));
945 Array Name = serializeScalar<StringRef>(TBDKey::Name,
File->getInstallName());
946 if (!insertNonEmptyValues(Library, TBDKey::InstallName, std::move(
Name)))
947 return make_error<JSONStubError>(getSerializeErrorMsg(TBDKey::InstallName));
951 insertNonEmptyValues(Library, TBDKey::Flags, std::move(Flags));
953 Array CurrentV = serializeScalar<PackedVersion, std::string>(
955 insertNonEmptyValues(Library, TBDKey::CurrentVersion, std::move(CurrentV));
957 Array CompatV = serializeScalar<PackedVersion, std::string>(
959 insertNonEmptyValues(Library, TBDKey::CompatibilityVersion,
962 Array SwiftABI = serializeScalar<uint8_t, int64_t>(
963 TBDKey::ABI,
File->getSwiftABIVersion(), 0u);
964 insertNonEmptyValues(Library, TBDKey::SwiftABI, std::move(SwiftABI));
966 Array RPaths = serializeField(TBDKey::Paths,
File->rpaths(), ActiveTargets);
967 insertNonEmptyValues(Library, TBDKey::RPath, std::move(RPaths));
969 Array Umbrellas = serializeField(TBDKey::Umbrella,
File->umbrellas(),
970 ActiveTargets,
false);
971 insertNonEmptyValues(Library, TBDKey::ParentUmbrella, std::move(Umbrellas));
974 serializeField(TBDKey::Clients,
File->allowableClients(), ActiveTargets);
975 insertNonEmptyValues(Library, TBDKey::AllowableClients, std::move(Clients));
978 serializeField(TBDKey::Names,
File->reexportedLibraries(), ActiveTargets);
979 insertNonEmptyValues(Library, TBDKey::ReexportLibs, std::move(ReexportLibs));
982 Array Exports = serializeSymbols(
File->exports(), ActiveTargets);
983 insertNonEmptyValues(Library, TBDKey::Exports, std::move(Exports));
985 Array Reexports = serializeSymbols(
File->reexports(), ActiveTargets);
986 insertNonEmptyValues(Library, TBDKey::Reexports, std::move(Reexports));
988 if (!
File->isTwoLevelNamespace()) {
989 Array Undefineds = serializeSymbols(
File->undefineds(), ActiveTargets);
990 insertNonEmptyValues(Library, TBDKey::Undefineds, std::move(Undefineds));
993 return std::move(Library);
997 assert(FileKind == FileType::TBD_V5 &&
"unexpected json file format version");
1000 auto MainLibOrErr = serializeIF(File);
1002 return MainLibOrErr;
1003 Root[Keys[TBDKey::MainLibrary]] = std::move(*MainLibOrErr);
1005 for (
const auto &Doc :
File->documents()) {
1006 auto LibOrErr = serializeIF(Doc.get());
1012 Root[Keys[TBDKey::TBDVersion]] = 5;
1013 insertNonEmptyValues(Root, TBDKey::Documents, std::move(Documents));
1014 return std::move(Root);
1023 auto TextFile = getJSON(&File, FileKind);
1025 return TextFile.takeError();
This file supports working with JSON data.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
static uint32_t getFlags(const Symbol *Sym)
virtual std::error_code convertToErrorCode() const =0
Convert this error to a std::error_code.
virtual void log(raw_ostream &OS) const =0
Print an error message to an output stream.
Base class for user error types.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
Defines the interface file.
std::pair< bool, bool > parse64(StringRef Str)
bool isWeakDefined() const
const_target_range targets() const
bool isThreadLocalValue() const
StringRef getName() const
EncodeKind getKind() const
bool isWeakReferenced() const
static llvm::Expected< Target > create(StringRef Target)
VersionTuple MinDeployment
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
Represents a version number in the form major[.minor[.subminor[.build]]].
std::string getAsString() const
Retrieve a string representation of the version number.
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
An Array is a JSON array, which contains heterogeneous JSON values.
void emplace_back(Args &&...A)
An Object is a JSON object, which maps strings to heterogenous JSON values.
const json::Object * getObject(StringRef K) const
std::optional< llvm::StringRef > getString(StringRef K) const
std::optional< int64_t > getInteger(StringRef K) const
const json::Array * getArray(StringRef K) const
A "cursor" marking a position within a Value.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::string getTargetTripleName(const Target &Targ)
FileType
Defines the file type TextAPI files can represent.
StringRef getArchitectureName(Architecture Arch)
Convert an architecture slice to a string.
std::string getOSAndEnvironmentName(PlatformType Platform, std::string Version="")
Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File, const FileType FileKind, bool Compact)
Expected< std::unique_ptr< InterfaceFile > > getInterfaceFileFromJSON(StringRef JSON)
EncodeKind
Mapping of entry types in TextStubs.
This is an optimization pass for GlobalISel generic memory operations.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
@ Ref
The access may reference the value stored in memory.
void consumeError(Error Err)
Consume a Error without doing anything.