<rdar://problem/11439022>
Restore expressions with no target.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156669 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 38cd75f..78c30f2 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -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;
}