Move type handling to make sure we get all created types that aren't
[oota-llvm.git] / lib / Archive / ArchiveWriter.cpp
index 07a9aaf4fdbe174e12ea03ea5d783884bd77d4a7..8fcc7aa29cc853ddbe9655088e56a20f24004626 100644 (file)
@@ -181,9 +181,11 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where,
     flags |= ArchiveMember::HasPathFlag;
   if (hasSlash || filePath.str().length() > 15)
     flags |= ArchiveMember::HasLongFilenameFlag;
-  std::string magic;
-  mbr->path.getMagicNumber(magic,4);
-  switch (sys::IdentifyFileType(magic.c_str(),4)) {
+
+  sys::LLVMFileType type;
+  if (sys::fs::identify_magic(mbr->path.str(), type))
+    type = sys::Unknown_FileType;
+  switch (type) {
     case sys::Bitcode_FileType:
       flags |= ArchiveMember::BitcodeFlag;
       break;