lib/System/Win32/ThreadLocal.inc: Suppress "unused" warning on -Asserts.
[oota-llvm.git] / lib / System / Path.cpp
index 4445c667d86e92f7784ef5d95536a9e3df9664af..ae166a574d1042a87b311b41063d180ed1055a1b 100644 (file)
@@ -127,6 +127,10 @@ sys::IdentifyFileType(const char *magic, unsigned length) {
       if (magic[1] == 0x02)
         return COFF_FileType;
       break;
+    case 0x64: // x86-64 Windows.
+      if (magic[1] == char(0x86))
+        return COFF_FileType;
+      break;
 
     default:
       break;
@@ -156,6 +160,20 @@ Path::isDynamicLibrary() const {
   return false;
 }
 
+bool
+Path::isObjectFile() const {
+  std::string Magic;
+  if (getMagicNumber(Magic, 64))
+    if (IdentifyFileType(Magic.c_str(),
+                         static_cast<unsigned>(Magic.length()))
+        != Unknown_FileType) {
+      // Everything in LLVMFileType is currently an object file.
+      return true;
+    }
+
+  return false;
+}
+
 Path
 Path::FindLibrary(std::string& name) {
   std::vector<sys::Path> LibPaths;