X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSystem%2FPath.cpp;h=ae166a574d1042a87b311b41063d180ed1055a1b;hb=5c0db76cf262bec095c6b52ba0aa6e095f9f8298;hp=4445c667d86e92f7784ef5d95536a9e3df9664af;hpb=4a295d301d83f07ad2840abe25a1691aef481c83;p=oota-llvm.git diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index 4445c667d86..ae166a574d1 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -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(Magic.length())) + != Unknown_FileType) { + // Everything in LLVMFileType is currently an object file. + return true; + } + + return false; +} + Path Path::FindLibrary(std::string& name) { std::vector LibPaths;