[cfe-commits] r60957 - /cfe/trunk/Driver/clang.cpp

Daniel Dunbar daniel at zuster.org
Fri Dec 12 10:34:36 PST 2008


Author: ddunbar
Date: Fri Dec 12 12:34:35 2008
New Revision: 60957

URL: http://llvm.org/viewvc/llvm-project?rev=60957&view=rev
Log:
Force i[0-9]86 to i386 when using LLVM_HOSTTRIPLE.

Only use major part of OS version when on darwin and modifying OS part
of target triple.

Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=60957&r1=60956&r2=60957&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Fri Dec 12 12:34:35 2008
@@ -790,13 +790,20 @@
   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"));
 
-      Triple += llvm::sys::osVersion();
+      // Only add the major part of the os version.
+      std::string Version = llvm::sys::osVersion();
+      Triple += Version.substr(0, Version.find('.'));
     }
   }
   





More information about the cfe-commits mailing list