[llvm] r366496 - Remove the static initialize introduced in r365099
Steven Wu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 14:01:22 PDT 2019
Author: steven_wu
Date: Thu Jul 18 14:01:21 2019
New Revision: 366496
URL: http://llvm.org/viewvc/llvm-project?rev=366496&view=rev
Log:
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
Modified:
llvm/trunk/lib/Object/MachOObjectFile.cpp
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=366496&r1=366495&r2=366496&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Thu Jul 18 14:01:21 2019
@@ -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));
More information about the llvm-commits
mailing list