From 95131fcb671f13b931ea3cbb6bbd3fd735f1c5dc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 27 May 2010 17:18:38 +0000 Subject: Use the return value of getMagicNumber instead of using a separate canRead() call. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104853 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkItems.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/Linker/LinkItems.cpp') diff --git a/lib/Linker/LinkItems.cpp b/lib/Linker/LinkItems.cpp index 2c225503d6..f0c7b68e69 100644 --- a/lib/Linker/LinkItems.cpp +++ b/lib/Linker/LinkItems.cpp @@ -174,13 +174,11 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) { return error("Cannot link stdin: " + Error); } - // Make sure we can at least read the file - if (!File.canRead()) + // Determine what variety of file it is. + std::string Magic; + if (!File.getMagicNumber(Magic, 64)) return error("Cannot find linker input '" + File.str() + "'"); - // If its an archive, try to link it in - std::string Magic; - File.getMagicNumber(Magic, 64); switch (sys::IdentifyFileType(Magic.c_str(), 64)) { default: llvm_unreachable("Bad file type identification"); case sys::Unknown_FileType: -- cgit v1.2.3