Fix bug 20125 - clang-format segfaults on bad config.
[oota-llvm.git] / lib / Support / Unix / Host.inc
index dc1641722b1d226392df003ebf1c6a04f33d93f9..c5d36ff8f9ce0825639e6e4f06815f0b335491d7 100644 (file)
@@ -35,11 +35,11 @@ static std::string getOSVersion() {
   return info.release;
 }
 
-std::string sys::getHostTriple() {
-  StringRef HostTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
-  std::pair<StringRef, StringRef> ArchSplit = HostTripleString.split('-');
+std::string sys::getDefaultTargetTriple() {
+  StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
+  std::pair<StringRef, StringRef> ArchSplit = TargetTripleString.split('-');
 
-  // Normalize the arch, since the host triple may not actually match the host.
+  // Normalize the arch, since the target triple may not actually match the target.
   std::string Arch = ArchSplit.first;
 
   std::string Triple(Arch);
@@ -52,12 +52,12 @@ std::string sys::getHostTriple() {
     Triple[1] = '3';
 
   // On darwin, we want to update the version to match that of the
-  // host.
+  // target.
   std::string::size_type DarwinDashIdx = Triple.find("-darwin");
   if (DarwinDashIdx != std::string::npos) {
     Triple.resize(DarwinDashIdx + strlen("-darwin"));
     Triple += getOSVersion();
   }
 
-  return Triple;
+  return Triple::normalize(Triple);
 }