llvm needs the OS to be set to either iOS or Mac OS X
authorJason Molenda <jmolenda@apple.com>
Tue, 16 Oct 2012 20:45:49 +0000 (20:45 +0000)
committerJason Molenda <jmolenda@apple.com>
Tue, 16 Oct 2012 20:45:49 +0000 (20:45 +0000)
to work properly; when doing bare-boards rom debugging
force the OS to be one of those when initializing llvm.
<rdar://problem/12504138>

llvm-svn: 166057

lldb/source/Core/Module.cpp

index 0c82b66..14d2e42 100644 (file)
@@ -314,6 +314,22 @@ Module::GetClangASTContext ()
         if (objfile && objfile->GetArchitecture(object_arch))
         {
             m_did_init_ast = true;
+
+            // LLVM wants this to be set to iOS or MacOSX; if we're working on
+            // a bare-boards type image, change the triple for llvm's benefit.
+            if (object_arch.GetTriple().getVendor() == llvm::Triple::Apple 
+                && object_arch.GetTriple().getOS() == llvm::Triple::UnknownOS)
+            {
+                if (object_arch.GetTriple().getArch() == llvm::Triple::arm || 
+                    object_arch.GetTriple().getArch() == llvm::Triple::thumb)
+                {
+                    object_arch.GetTriple().setOS(llvm::Triple::IOS);
+                }
+                else
+                {
+                    object_arch.GetTriple().setOS(llvm::Triple::MacOSX);
+                }
+            }
             m_ast.SetArchitecture (object_arch);
         }
     }