diff options
| author | Shoaib Meenai <smeenai@fb.com> | 2019-07-04 00:17:02 +0000 |
|---|---|---|
| committer | Shoaib Meenai <smeenai@fb.com> | 2019-07-04 00:17:02 +0000 |
| commit | 995798d2d58499f598ba125810e8e18799d900b1 (patch) | |
| tree | 9476b4dc7f072188179493d4426906bb5eb32ab0 /llvm/tools/llvm-lipo/llvm-lipo.cpp | |
| parent | f5a885fddd63b7a07ddaf1c056bbef8c34a5f6c8 (diff) | |
| download | bcm5719-llvm-995798d2d58499f598ba125810e8e18799d900b1.tar.gz bcm5719-llvm-995798d2d58499f598ba125810e8e18799d900b1.zip | |
[MachO] Add valid architecture function
Added array of valid architectures and function returning array.
Modified llvm-lipo to include list of valid architectures in error message for invalid arch.
Patch by Anusha Basana <anusha.basana@gmail.com>
Differential Revision: https://reviews.llvm.org/D63735
llvm-svn: 365099
Diffstat (limited to 'llvm/tools/llvm-lipo/llvm-lipo.cpp')
| -rw-r--r-- | llvm/tools/llvm-lipo/llvm-lipo.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/tools/llvm-lipo/llvm-lipo.cpp b/llvm/tools/llvm-lipo/llvm-lipo.cpp index 902cd81e4a5..ea0d427e019 100644 --- a/llvm/tools/llvm-lipo/llvm-lipo.cpp +++ b/llvm/tools/llvm-lipo/llvm-lipo.cpp @@ -93,8 +93,15 @@ struct Config { } // end namespace static void validateArchitectureName(StringRef ArchitectureName) { - if (Triple(ArchitectureName).getArch() == Triple::ArchType::UnknownArch) - reportError("Invalid architecture: " + ArchitectureName); + if (!MachOObjectFile::isValidArch(ArchitectureName)) { + std::string Buf; + raw_string_ostream OS(Buf); + OS << "Invalid architecture: " << ArchitectureName + << "\nValid architecture names are:"; + for (auto arch : MachOObjectFile::getValidArchs()) + OS << " " << arch; + reportError(OS.str()); + } } static Config parseLipoOptions(ArrayRef<const char *> ArgsArr) { |

