diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-11 14:39:59 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-11 14:39:59 +0000 |
commit | de6fe4d604e561a58854f09a3d985ea59e4db973 (patch) | |
tree | 4a20c202a756bd2f790859374c0aa32cd6dbdb4e /lib | |
parent | 6c59c7a6fdc5b58de4f3c349b59a567c239818e4 (diff) | |
download | external_llvm-de6fe4d604e561a58854f09a3d985ea59e4db973.zip external_llvm-de6fe4d604e561a58854f09a3d985ea59e4db973.tar.gz external_llvm-de6fe4d604e561a58854f09a3d985ea59e4db973.tar.bz2 |
Convert a use of sys::identifyFileType to sys::fs::identify_magic.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Object/Binary.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp index 5d816e1..201899f 100644 --- a/lib/Object/Binary.cpp +++ b/lib/Object/Binary.cpp @@ -14,6 +14,7 @@ #include "llvm/Object/Binary.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" // Include headers for createBinary. @@ -45,19 +46,19 @@ error_code object::createBinary(MemoryBuffer *Source, OwningPtr<MemoryBuffer> scopedSource(Source); if (!Source) return make_error_code(errc::invalid_argument); - sys::LLVMFileType type = sys::identifyFileType(Source->getBuffer()); + sys::fs::file_magic type = sys::fs::identify_magic(Source->getBuffer()); error_code ec; switch (type) { - case sys::Archive_FileType: { + case sys::fs::file_magic::archive: { OwningPtr<Binary> ret(new Archive(scopedSource.take(), ec)); if (ec) return ec; Result.swap(ret); return object_error::success; } - case sys::ELF_Relocatable_FileType: - case sys::ELF_Executable_FileType: - case sys::ELF_SharedObject_FileType: - case sys::ELF_Core_FileType: { + case sys::fs::file_magic::elf_relocatable: + case sys::fs::file_magic::elf_executable: + case sys::fs::file_magic::elf_shared_object: + case sys::fs::file_magic::elf_core: { OwningPtr<Binary> ret( ObjectFile::createELFObjectFile(scopedSource.take())); if (!ret) @@ -65,15 +66,15 @@ error_code object::createBinary(MemoryBuffer *Source, Result.swap(ret); return object_error::success; } - case sys::Mach_O_Object_FileType: - case sys::Mach_O_Executable_FileType: - case sys::Mach_O_FixedVirtualMemorySharedLib_FileType: - case sys::Mach_O_Core_FileType: - case sys::Mach_O_PreloadExecutable_FileType: - case sys::Mach_O_DynamicallyLinkedSharedLib_FileType: - case sys::Mach_O_DynamicLinker_FileType: - case sys::Mach_O_Bundle_FileType: - case sys::Mach_O_DynamicallyLinkedSharedLibStub_FileType: { + case sys::fs::file_magic::macho_object: + case sys::fs::file_magic::macho_executable: + case sys::fs::file_magic::macho_fixed_virtual_memory_shared_lib: + case sys::fs::file_magic::macho_core: + case sys::fs::file_magic::macho_preload_executable: + case sys::fs::file_magic::macho_dynamically_linked_shared_lib: + case sys::fs::file_magic::macho_dynamic_linker: + case sys::fs::file_magic::macho_bundle: + case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub: { OwningPtr<Binary> ret( ObjectFile::createMachOObjectFile(scopedSource.take())); if (!ret) @@ -81,7 +82,8 @@ error_code object::createBinary(MemoryBuffer *Source, Result.swap(ret); return object_error::success; } - case sys::COFF_FileType: { + case sys::fs::file_magic::coff_object: + case sys::fs::file_magic::pecoff_executable: { OwningPtr<Binary> ret(new COFFObjectFile(scopedSource.take(), ec)); if (ec) return ec; Result.swap(ret); |