[Lldb-commits] [lldb] r156669 - /lldb/trunk/source/Host/common/Host.cpp

Greg Clayton gclayton at apple.com
Fri May 11 17:01:21 PDT 2012


Author: gclayton
Date: Fri May 11 19:01:21 2012
New Revision: 156669

URL: http://llvm.org/viewvc/llvm-project?rev=156669&view=rev
Log:
<rdar://problem/11439022>

Restore expressions with no target.


Modified:
    lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=156669&r1=156668&r2=156669&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Fri May 11 19:01:21 2012
@@ -371,12 +371,9 @@
     if (!g_vendor)
     {
 #if defined (__APPLE__)
-        char ostype[64];
-        size_t len = sizeof(ostype);
-        if (::sysctlbyname("kern.ostype", &ostype, &len, NULL, 0) == 0)
-            g_vendor.SetCString (ostype);
-        else
-            g_vendor.SetCString("apple");
+        const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
+        const llvm::StringRef &str_ref = host_arch.GetTriple().getVendorName();
+        g_vendor.SetCStringWithLength(str_ref.data(), str_ref.size());
 #elif defined (__linux__)
         g_vendor.SetCString("gnu");
 #elif defined (__FreeBSD__)
@@ -393,7 +390,9 @@
     if (!g_os_string)
     {
 #if defined (__APPLE__)
-        g_os_string.SetCString("darwin");
+        const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
+        const llvm::StringRef &str_ref = host_arch.GetTriple().getOSName();
+        g_os_string.SetCStringWithLength(str_ref.data(), str_ref.size());
 #elif defined (__linux__)
         g_os_string.SetCString("linux");
 #elif defined (__FreeBSD__)
@@ -409,18 +408,8 @@
     static ConstString g_host_triple;
     if (!(g_host_triple))
     {
-        StreamString triple;
-        triple.Printf("%s-%s-%s", 
-                      GetArchitecture().GetArchitectureName(),
-                      GetVendorString().AsCString(),
-                      GetOSString().AsCString());
-
-        std::transform (triple.GetString().begin(), 
-                        triple.GetString().end(), 
-                        triple.GetString().begin(), 
-                        ::tolower);
-
-        g_host_triple.SetCString(triple.GetString().c_str());
+        const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
+        g_host_triple.SetCString(host_arch.GetTriple().getTriple().c_str());
     }
     return g_host_triple;
 }





More information about the lldb-commits mailing list