diff options
author | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
commit | 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (patch) | |
tree | 19c69a04768629f2d440944b71cbe90adae0b615 /lib/Support/Path.cpp | |
parent | 07637c87f826cdf411f0673595e9bc92ebd793f2 (diff) | |
download | FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.zip FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.tar.gz |
Vendor import of llvm trunk r154661:
http://llvm.org/svn/llvm-project/llvm/trunk@r154661
Diffstat (limited to 'lib/Support/Path.cpp')
-rw-r--r-- | lib/Support/Path.cpp | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index e5b7cd3..dcddeda 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -38,16 +38,6 @@ bool Path::operator<(const Path& that) const { return path < that.path; } -Path -Path::GetLLVMConfigDir() { - Path result; -#ifdef LLVM_ETCDIR - if (result.set(LLVM_ETCDIR)) - return result; -#endif - return GetLLVMDefaultConfigDir(); -} - LLVMFileType sys::IdentifyFileType(const char *magic, unsigned length) { assert(magic && "Invalid magic number string"); @@ -100,7 +90,7 @@ sys::IdentifyFileType(const char *magic, unsigned length) { case 0xCF: { uint16_t type = 0; if (magic[0] == char(0xFE) && magic[1] == char(0xED) && - magic[2] == char(0xFA) && + magic[2] == char(0xFA) && (magic[3] == char(0xCE) || magic[3] == char(0xCF))) { /* Native endian */ if (length >= 16) type = magic[14] << 8 | magic[15]; @@ -162,31 +152,31 @@ sys::IdentifyFileType(const char *magic, unsigned length) { bool Path::isArchive() const { - LLVMFileType type; + fs::file_magic type; if (fs::identify_magic(str(), type)) return false; - return type == Archive_FileType; + return type == fs::file_magic::archive; } bool Path::isDynamicLibrary() const { - LLVMFileType type; + fs::file_magic type; if (fs::identify_magic(str(), type)) return false; switch (type) { default: return false; - case Mach_O_FixedVirtualMemorySharedLib_FileType: - case Mach_O_DynamicallyLinkedSharedLib_FileType: - case Mach_O_DynamicallyLinkedSharedLibStub_FileType: - case ELF_SharedObject_FileType: - case COFF_FileType: return true; + case fs::file_magic::macho_fixed_virtual_memory_shared_lib: + case fs::file_magic::macho_dynamically_linked_shared_lib: + case fs::file_magic::macho_dynamically_linked_shared_lib_stub: + case fs::file_magic::elf_shared_object: + case fs::file_magic::pecoff_executable: return true; } } bool Path::isObjectFile() const { - LLVMFileType type; - if (fs::identify_magic(str(), type) || type == Unknown_FileType) + fs::file_magic type; + if (fs::identify_magic(str(), type) || type == fs::file_magic::unknown) return false; return true; } @@ -222,10 +212,10 @@ Path::appendSuffix(StringRef suffix) { bool Path::isBitcodeFile() const { - LLVMFileType type; + fs::file_magic type; if (fs::identify_magic(str(), type)) return false; - return type == Bitcode_FileType; + return type == fs::file_magic::bitcode; } bool Path::hasMagicNumber(StringRef Magic) const { |