diff options
| author | Tim Northover <tnorthover@apple.com> | 2015-02-12 15:12:13 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2015-02-12 15:12:13 +0000 |
| commit | be0fda3c33428efdcad1556a4db7a57fafb3b9f4 (patch) | |
| tree | fad681ef5d1fd15ad243690b10cc7aafa1a57d40 /llvm/lib/Support/Unix | |
| parent | c2707bb883907e841f9814796efc166593094f2f (diff) | |
| download | bcm5719-llvm-be0fda3c33428efdcad1556a4db7a57fafb3b9f4.tar.gz bcm5719-llvm-be0fda3c33428efdcad1556a4db7a57fafb3b9f4.zip | |
Triple: refactor redundant code.
Should be no functional change, since most of the logic removed was
completely pointless (after some previous refactoring) and the rest
duplicated elsewhere.
Patch by Kamil Rytarowski.
llvm-svn: 228926
Diffstat (limited to 'llvm/lib/Support/Unix')
| -rw-r--r-- | llvm/lib/Support/Unix/Host.inc | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/llvm/lib/Support/Unix/Host.inc b/llvm/lib/Support/Unix/Host.inc index 519f2a1fe68..457217125a2 100644 --- a/llvm/lib/Support/Unix/Host.inc +++ b/llvm/lib/Support/Unix/Host.inc @@ -35,29 +35,15 @@ static std::string getOSVersion() { } std::string sys::getDefaultTargetTriple() { - StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE); - std::pair<StringRef, StringRef> ArchSplit = TargetTripleString.split('-'); - - // Normalize the arch, since the target triple may not actually match the - // target. - std::string Arch = ArchSplit.first; - - std::string Triple(Arch); - Triple += '-'; - Triple += ArchSplit.second; - - // Force i<N>86 to i386. - if (Triple[0] == 'i' && isdigit(Triple[1]) && - Triple[2] == '8' && Triple[3] == '6') - Triple[1] = '3'; + std::string TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE); // On darwin, we want to update the version to match that of the // target. - std::string::size_type DarwinDashIdx = Triple.find("-darwin"); + std::string::size_type DarwinDashIdx = TargetTripleString.find("-darwin"); if (DarwinDashIdx != std::string::npos) { - Triple.resize(DarwinDashIdx + strlen("-darwin")); - Triple += getOSVersion(); + TargetTripleString.resize(DarwinDashIdx + strlen("-darwin")); + TargetTripleString += getOSVersion(); } - return Triple::normalize(Triple); + return Triple::normalize(TargetTripleString); } |

