(LLVM up) Update to use llvm::sys::getHostTriple().
 - Always pass -triple to clang-cc (-arch will be removed).

 - clang-cc doesn't play guess work with the target triple anymore.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68119 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/clang.cpp b/tools/clang-cc/clang.cpp
index 7541f80..bd6456b 100644
--- a/tools/clang-cc/clang.cpp
+++ b/tools/clang-cc/clang.cpp
@@ -764,7 +764,7 @@
   
   if (MacOSVersionMinIsInvalid) {
     fprintf(stderr, 
-        "-mmacosx-version-min=%s is invalid, expected something like '10.4'.\n", 
+        "-mmacosx-version-min=%s is invalid, expected something like '10.4'.\n",
             MacOSVersionMin.c_str());
     exit(1);
   }
@@ -776,25 +776,8 @@
   // Initialize base triple.  If a -triple option has been specified, use
   // that triple.  Otherwise, default to the host triple.
   std::string Triple = TargetTriple;
-  if (Triple.empty()) {
-    Triple = LLVM_HOSTTRIPLE;
-
-    // Force i<N>86 to i386 when using LLVM_HOSTTRIPLE.
-    if (Triple[0] == 'i' && isdigit(Triple[1]) && 
-        Triple[2] == '8' && Triple[3] == '6')
-      Triple[1] = '3';
-
-    // On darwin, we want to update the version to match that of the
-    // host.    
-    std::string::size_type DarwinDashIdx = Triple.find("-darwin");
-    if (DarwinDashIdx != std::string::npos) {
-      Triple.resize(DarwinDashIdx + strlen("-darwin"));
-
-      // Only add the major part of the os version.
-      std::string Version = llvm::sys::getOSVersion();
-      Triple += Version.substr(0, Version.find('.'));
-    }
-  }
+  if (Triple.empty())
+    Triple = llvm::sys::getHostTriple();
   
   // If -arch foo was specified, remove the architecture from the triple we have
   // so far and replace it with the specified one.