llvm.org GIT mirror llvm / ab33203
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366496 91177308-0d34-0410-b5e6-96231b3b80d8 Steven Wu a month ago
1 changed file(s) with 13 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
5555 };
5656
5757 } // end anonymous namespace
58
59 static const std::array validArchs = {
60 "i386", "x86_64", "x86_64h", "armv4t", "arm", "armv5e",
61 "armv6", "armv6m", "armv7", "armv7em", "armv7k", "armv7m",
62 "armv7s", "arm64", "arm64_32", "ppc", "ppc64",
63 };
6458
6559 static Error malformedError(const Twine &Msg) {
6660 return make_error("truncated or malformed object (" +
27232717 }
27242718
27252719 bool MachOObjectFile::isValidArch(StringRef ArchFlag) {
2726 return std::find(validArchs.cbegin(), validArchs.cend(), ArchFlag) !=
2727 validArchs.cend();
2728 }
2729
2730 ArrayRef MachOObjectFile::getValidArchs() { return validArchs; }
2720 auto validArchs = getValidArchs();
2721 return llvm::find(validArchs, ArchFlag) != validArchs.end();
2722 }
2723
2724 ArrayRef MachOObjectFile::getValidArchs() {
2725 static const std::array validArchs = {
2726 "i386", "x86_64", "x86_64h", "armv4t", "arm", "armv5e",
2727 "armv6", "armv6m", "armv7", "armv7em", "armv7k", "armv7m",
2728 "armv7s", "arm64", "arm64_32", "ppc", "ppc64",
2729 };
2730
2731 return validArchs;
2732 }
27312733
27322734 Triple::ArchType MachOObjectFile::getArch() const {
27332735 return getArch(getCPUType(*this));