Use the return value of getMagicNumber instead of using a
authorDan Gohman <gohman@apple.com>
Thu, 27 May 2010 17:18:38 +0000 (17:18 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 27 May 2010 17:18:38 +0000 (17:18 +0000)
separate canRead() call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104853 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/LinkItems.cpp

index 2c225503d619f97cead1708136563b43692c5017..f0c7b68e69bbdf372f80366f248577d0828e88b2 100644 (file)
@@ -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: