summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-11 17:28:56 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-11 17:28:56 +0000
commit9e26acb5b55f47a4a963c1535fd6b9cb640fa4b6 (patch)
tree8e92cc5e4e10a231f3bd0c5c63da5e0db63c0be6
parent0179706213212cd35f43365ad912558ebe0e84b0 (diff)
downloadexternal_llvm-9e26acb5b55f47a4a963c1535fd6b9cb640fa4b6.zip
external_llvm-9e26acb5b55f47a4a963c1535fd6b9cb640fa4b6.tar.gz
external_llvm-9e26acb5b55f47a4a963c1535fd6b9cb640fa4b6.tar.bz2
Convert another use of sys::identifyFileType.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183754 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Archive/ArchiveReader.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index 6550599..6946ddb 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Module.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include <cstdio>
#include <cstdlib>
@@ -205,14 +206,11 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
}
// Determine if this is a bitcode file
- switch (sys::identifyFileType(StringRef(At, 4))) {
- case sys::Bitcode_FileType:
- flags |= ArchiveMember::BitcodeFlag;
- break;
- default:
- flags &= ~ArchiveMember::BitcodeFlag;
- break;
- }
+ if (sys::fs::identify_magic(StringRef(At, 4)) ==
+ sys::fs::file_magic::bitcode)
+ flags |= ArchiveMember::BitcodeFlag;
+ else
+ flags &= ~ArchiveMember::BitcodeFlag;
// Instantiate the ArchiveMember to be filled
ArchiveMember* member = new ArchiveMember(this);