Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Object/TapiUniversal.h
Show All 35 Lines | public: | ||||
ObjectForArch getNext() const { return ObjectForArch(Parent, Index + 1); } | ObjectForArch getNext() const { return ObjectForArch(Parent, Index + 1); } | ||||
bool operator==(const ObjectForArch &Other) const { | bool operator==(const ObjectForArch &Other) const { | ||||
return (Parent == Other.Parent) && (Index == Other.Index); | return (Parent == Other.Parent) && (Index == Other.Index); | ||||
} | } | ||||
uint32_t getCPUType() const { | uint32_t getCPUType() const { | ||||
auto Result = | auto Result = | ||||
MachO::getCPUTypeFromArchitecture(Parent->Architectures[Index]); | MachO::getCPUTypeFromArchitecture(Parent->Libraries[Index].Arch); | ||||
return Result.first; | return Result.first; | ||||
} | } | ||||
uint32_t getCPUSubType() const { | uint32_t getCPUSubType() const { | ||||
auto Result = | auto Result = | ||||
MachO::getCPUTypeFromArchitecture(Parent->Architectures[Index]); | MachO::getCPUTypeFromArchitecture(Parent->Libraries[Index].Arch); | ||||
return Result.second; | return Result.second; | ||||
} | } | ||||
StringRef getArchFlagName() const { | StringRef getArchFlagName() const { | ||||
return MachO::getArchitectureName(Parent->Architectures[Index]); | return MachO::getArchitectureName(Parent->Libraries[Index].Arch); | ||||
} | |||||
jhenderson: Nit: missing blank line between this and the previous function. | |||||
std::string getInstallName() const { | |||||
return std::string(Parent->Libraries[Index].InstallName); | |||||
} | |||||
bool isTopLevelLib() const { | |||||
return Parent->ParsedFile->getInstallName() == getInstallName(); | |||||
} | } | ||||
Expected<std::unique_ptr<TapiFile>> getAsObjectFile() const; | Expected<std::unique_ptr<TapiFile>> getAsObjectFile() const; | ||||
}; | }; | ||||
class object_iterator { | class object_iterator { | ||||
ObjectForArch Obj; | ObjectForArch Obj; | ||||
Show All 17 Lines | public: | ||||
TapiUniversal(MemoryBufferRef Source, Error &Err); | TapiUniversal(MemoryBufferRef Source, Error &Err); | ||||
static Expected<std::unique_ptr<TapiUniversal>> | static Expected<std::unique_ptr<TapiUniversal>> | ||||
create(MemoryBufferRef Source); | create(MemoryBufferRef Source); | ||||
~TapiUniversal() override; | ~TapiUniversal() override; | ||||
object_iterator begin_objects() const { return ObjectForArch(this, 0); } | object_iterator begin_objects() const { return ObjectForArch(this, 0); } | ||||
object_iterator end_objects() const { | object_iterator end_objects() const { | ||||
return ObjectForArch(this, Architectures.size()); | return ObjectForArch(this, Libraries.size()); | ||||
} | } | ||||
iterator_range<object_iterator> objects() const { | iterator_range<object_iterator> objects() const { | ||||
return make_range(begin_objects(), end_objects()); | return make_range(begin_objects(), end_objects()); | ||||
} | } | ||||
uint32_t getNumberOfObjects() const { return Architectures.size(); } | uint32_t getNumberOfObjects() const { return Libraries.size(); } | ||||
// Cast methods. | |||||
static bool classof(const Binary *v) { return v->isTapiUniversal(); } | static bool classof(const Binary *v) { return v->isTapiUniversal(); } | ||||
private: | private: | ||||
struct Library { | |||||
StringRef InstallName; | |||||
MachO::Architecture Arch; | |||||
}; | |||||
std::unique_ptr<MachO::InterfaceFile> ParsedFile; | std::unique_ptr<MachO::InterfaceFile> ParsedFile; | ||||
std::vector<MachO::Architecture> Architectures; | std::vector<Library> Libraries; | ||||
}; | }; | ||||
} // end namespace object. | } // end namespace object. | ||||
} // end namespace llvm. | } // end namespace llvm. | ||||
#endif // LLVM_OBJECT_TAPI_UNIVERSAL_H | #endif // LLVM_OBJECT_TAPI_UNIVERSAL_H |
Nit: missing blank line between this and the previous function.