diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-10-02 07:28:34 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-10-02 07:28:34 +0000 |
commit | a9402e4b433d79037fabe96fd6ca2a890d47f426 (patch) | |
tree | f03f7617c9ad6280e1808d670145d9ccc8cd4980 /lib/Driver/ToolChains.cpp | |
parent | bc0df7240851f46f07c1a356aa7d1aee26115c31 (diff) |
Simplify this through the power of the ternary operator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 7fea2c0c18..b32fb570f3 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1630,16 +1630,11 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) bool Is32Bits = (getArch() == llvm::Triple::x86 || getArch() == llvm::Triple::ppc); - std::string Suffix32 = ""; - if (Arch == llvm::Triple::x86_64) - Suffix32 = "/32"; - - std::string Suffix64 = ""; - if (Is32Bits) - Suffix64 = "/64"; + const std::string Suffix32 = Arch == llvm::Triple::x86_64 ? "/32" : ""; + const std::string Suffix64 = Is32Bits ? "/64" : ""; + const std::string Suffix = Is32Bits ? Suffix32 : Suffix64; std::string Lib32 = "lib"; - if (!llvm::sys::fs::exists("/lib32", Exists) && Exists) Lib32 = "lib32"; @@ -1649,16 +1644,7 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) (llvm::sys::fs::is_symlink("/lib64", Symlink) || !Symlink)) Lib64 = "lib64"; - std::string Suffix; - std::string Lib; - - if (Is32Bits) { - Suffix = Suffix32; - Lib = Lib32; - } else { - Suffix = Suffix64; - Lib = Lib64; - } + std::string Lib = Is32Bits ? Lib32 : Lib64; // OpenSuse stores the linker with the compiler, add that to the search // path. |