Platforms can now auto-select themselves if you specify a full target triple when doing a "target create" command.

Each platform now knows if it can handle an architecture and a platform can be found using an architecture. Each platform can look at the arch, vendor and OS and know if it should be used or not.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153104 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/OptionGroupPlatform.cpp b/source/Interpreter/OptionGroupPlatform.cpp
index 4e54c39..ca2f3ff 100644
--- a/source/Interpreter/OptionGroupPlatform.cpp
+++ b/source/Interpreter/OptionGroupPlatform.cpp
@@ -21,30 +21,36 @@
 using namespace lldb_private;
 
 PlatformSP 
-OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, bool make_selected, Error& error) const
+OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Error& error) const
 {
     PlatformSP platform_sp;
+    
     if (!m_platform_name.empty())
     {
         platform_sp = Platform::Create (m_platform_name.c_str(), error);
-        
-        if (platform_sp)
-        {
-            interpreter.GetDebugger().GetPlatformList().Append (platform_sp, make_selected);
-            if (m_os_version_major != UINT32_MAX)
-            {
-                platform_sp->SetOSVersion (m_os_version_major,
-                                           m_os_version_minor,
-                                           m_os_version_update);
-            }
-            
-            if (m_sdk_sysroot)
-                platform_sp->SetSDKRootDirectory (m_sdk_sysroot);
-
-            if (m_sdk_build)
-                platform_sp->SetSDKBuild (m_sdk_build);
-        }
     }
+    else if (arch.IsValid())
+    {
+        platform_sp = Platform::Create (arch, error);
+    }
+    
+    if (platform_sp)
+    {
+        interpreter.GetDebugger().GetPlatformList().Append (platform_sp, make_selected);
+        if (m_os_version_major != UINT32_MAX)
+        {
+            platform_sp->SetOSVersion (m_os_version_major,
+                                       m_os_version_minor,
+                                       m_os_version_update);
+        }
+        
+        if (m_sdk_sysroot)
+            platform_sp->SetSDKRootDirectory (m_sdk_sysroot);
+        
+        if (m_sdk_build)
+            platform_sp->SetSDKBuild (m_sdk_build);
+    }
+
     return platform_sp;
 }