Remove the static initialize introduced in r365099

Summary:
Some polish for r365099 which adds a static initializer to
MachOObjectFile. Remove it by moving it to file scope.

Reviewers: smeenai, alexshap, compnerd, mtrent, anushabasana

Reviewed By: smeenai

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64873

llvm-svn: 366496
This commit is contained in:
Steven Wu 2019-07-18 21:01:21 +00:00
parent 79976b3790
commit dac7fca530
1 changed files with 11 additions and 9 deletions

View File

@ -57,12 +57,6 @@ namespace {
} // end anonymous namespace
static const std::array<StringRef, 17> 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<GenericBinaryError>("truncated or malformed object (" +
Msg + ")",
@ -2724,11 +2718,19 @@ Triple MachOObjectFile::getHostArch() {
}
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<StringRef> MachOObjectFile::getValidArchs() { return validArchs; }
ArrayRef<StringRef> MachOObjectFile::getValidArchs() {
static const std::array<StringRef, 17> 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));