<rdar://problem/11358639>

Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples.

Also make the selection process for auto selecting platforms based off of an arch much better.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156354 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
index 03b9d91..af4b7a8 100644
--- a/source/Target/Platform.cpp
+++ b/source/Target/Platform.cpp
@@ -130,22 +130,26 @@
 
 
 PlatformSP
-Platform::Create (const ArchSpec &arch, Error &error)
+Platform::Create (const ArchSpec &arch, ArchSpec *platform_arch_ptr, Error &error)
 {
     lldb::PlatformSP platform_sp;
     if (arch.IsValid())
     {
+        uint32_t idx;
         PlatformCreateInstance create_callback;
-        for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
+        for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
         {
             if (create_callback)
                 platform_sp.reset(create_callback(false, &arch));
-            if (platform_sp && platform_sp->IsCompatibleWithArchitecture(arch))
-                break;
+            if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, platform_arch_ptr))
+                return platform_sp;
         }
     }
     else
         error.SetErrorString ("invalid platform name");
+    if (platform_arch_ptr)
+        platform_arch_ptr->Clear();
+    platform_sp.reset();
     return platform_sp;
 }
 
@@ -632,12 +636,12 @@
 
 
 lldb::PlatformSP
-Platform::GetPlatformForArchitecture (const ArchSpec &arch)
+Platform::GetPlatformForArchitecture (const ArchSpec &arch, ArchSpec *platform_arch_ptr)
 {
     lldb::PlatformSP platform_sp;
     Error error;
     if (arch.IsValid())
-        platform_sp = Platform::Create (arch, error);
+        platform_sp = Platform::Create (arch, platform_arch_ptr, error);
     return platform_sp;
 }
 
@@ -647,18 +651,24 @@
 /// architecture and the target triple contained within.
 //------------------------------------------------------------------
 bool
-Platform::IsCompatibleWithArchitecture (const ArchSpec &arch)
+Platform::IsCompatibleArchitecture (const ArchSpec &arch, ArchSpec *compatible_arch_ptr)
 {
     // If the architecture is invalid, we must answer true...
-    if (!arch.IsValid())
-        return true;
-    
-    ArchSpec platform_arch;
-    for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
+    if (arch.IsValid())
     {
-        if (arch == platform_arch)
-            return true;
+        ArchSpec platform_arch;
+        for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
+        {
+            if (arch == platform_arch)
+            {
+                if (compatible_arch_ptr)
+                    *compatible_arch_ptr = platform_arch;
+                return true;
+            }
+        }
     }
+    if (compatible_arch_ptr)
+        compatible_arch_ptr->Clear();
     return false;
     
 }