[PATCH] Replace nested switch statements.
Joerg Sonnenberger
joerg at NetBSD.org
Fri Jan 3 17:24:48 PST 2014
One small change, otherwise LGTM.
================
Comment at: lib/Driver/GnuLdDriver.cpp:128
@@ +127,3 @@
+static llvm::Optional<llvm::Triple::ArchType>
+getArchType(const llvm::Triple &triple, const std::string &value) {
+ if (triple.getOS() != llvm::Triple::NetBSD)
----------------
Use a StringRef here.
================
Comment at: lib/Driver/GnuLdDriver.cpp:151
@@ -132,22 +150,3 @@
std::string value(arg->getValue());
-
- switch (triple.getOS()) {
- case llvm::Triple::NetBSD:
- switch (triple.getArch()) {
- case llvm::Triple::x86:
- case llvm::Triple::x86_64:
- if (value == "elf_i386") {
- triple.setArch(llvm::Triple::x86);
- return true;
- }
- if (value == "elf_x86_64") {
- triple.setArch(llvm::Triple::x86_64);
- return true;
- }
- break;
- default:
- break;
- }
- break;
- default:
- break;
+ llvm::Optional<llvm::Triple::ArchType> arch = getArchType(triple, value);
+ if (!arch) {
----------------
...and pass down arg->getValue() directly.
http://llvm-reviews.chandlerc.com/D2501
More information about the llvm-commits
mailing list