diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -57,12 +57,6 @@ } // end anonymous namespace -static const std::array validArchs = { - "i386", "x86_64", "x86_64h", "armv4t", "arm", "armv5e", - "armv6", "armv6m", "armv7", "armv7em", "armv7k", "armv7m", - "armv7s", "arm64", "arm64_32", "ppc", "ppc64", -}; - static Error malformedError(const Twine &Msg) { return make_error("truncated or malformed object (" + Msg + ")", @@ -2724,11 +2718,19 @@ } bool MachOObjectFile::isValidArch(StringRef ArchFlag) { - return std::find(validArchs.cbegin(), validArchs.cend(), ArchFlag) != - validArchs.cend(); + auto validArchs = getValidArchs(); + return llvm::find(validArchs, ArchFlag) != validArchs.end(); } -ArrayRef MachOObjectFile::getValidArchs() { return validArchs; } +ArrayRef MachOObjectFile::getValidArchs() { + static const std::array validArchs = { + "i386", "x86_64", "x86_64h", "armv4t", "arm", "armv5e", + "armv6", "armv6m", "armv7", "armv7em", "armv7k", "armv7m", + "armv7s", "arm64", "arm64_32", "ppc", "ppc64", + }; + + return validArchs; +} Triple::ArchType MachOObjectFile::getArch() const { return getArch(getCPUType(*this));