[PATCH] D63735: [MachOObjectFile]Added Valid Architecture Function
Steven Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 11:17:19 PDT 2019
steven_wu added a comment.
This adds an unnecessary static initializer to the MachOObject.cpp. Can you move the array of validArchs into filescope? You can declare it in getValidArchs() and use getValidArchs() in isValidArchs.
================
Comment at: llvm/trunk/lib/Object/MachOObjectFile.cpp:2727
bool MachOObjectFile::isValidArch(StringRef ArchFlag) {
- return StringSwitch<bool>(ArchFlag)
- .Case("i386", true)
- .Case("x86_64", true)
- .Case("x86_64h", true)
- .Case("armv4t", true)
- .Case("arm", true)
- .Case("armv5e", true)
- .Case("armv6", true)
- .Case("armv6m", true)
- .Case("armv7", true)
- .Case("armv7em", true)
- .Case("armv7k", true)
- .Case("armv7m", true)
- .Case("armv7s", true)
- .Case("arm64", true)
- .Case("arm64_32", true)
- .Case("ppc", true)
- .Case("ppc64", true)
- .Default(false);
+ return std::find(validArchs.cbegin(), validArchs.cend(), ArchFlag) !=
+ validArchs.cend();
----------------
`llvm::find` is easier here.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63735/new/
https://reviews.llvm.org/D63735
More information about the llvm-commits
mailing list