[PATCH] D64873: Remove the static initialize introduced in r365099
Steven Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 10:45:21 PDT 2019
steven_wu created this revision.
steven_wu added reviewers: smeenai, alexshap, compnerd, mtrent, anushabasana.
Herald added subscribers: dexonsmith, jkorous, hiraditya.
Herald added a project: LLVM.
Some polish for r365099 which adds a static initializer to
MachOObjectFile. Remove it by moving it to file scope.
Repository:
rG LLVM Github Monorepo
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.210368.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190717/661ad104/attachment.bin>
More information about the llvm-commits
mailing list