[PATCH] D64873: Remove the static initialize introduced in r365099
Steven Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 14:04:27 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdac7fca530f7: Remove the static initialize introduced in r365099 (authored by steven_wu).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64873/new/
https://reviews.llvm.org/D64873
Files:
llvm/lib/Object/MachOObjectFile.cpp
Index: llvm/lib/Object/MachOObjectFile.cpp
===================================================================
--- llvm/lib/Object/MachOObjectFile.cpp
+++ llvm/lib/Object/MachOObjectFile.cpp
@@ -57,12 +57,6 @@
} // 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 @@
}
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));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64873.210666.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190718/dc3cb561/attachment.bin>
More information about the llvm-commits
mailing list