summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkItems.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-27 17:18:38 +0000
committerDan Gohman <gohman@apple.com>2010-05-27 17:18:38 +0000
commitece4bf5148f641d695458d252ce49bcb81b44571 (patch)
tree6e2c3c935bc901b1f7df05f6469e14744b186e80 /llvm/lib/Linker/LinkItems.cpp
parent78d1e84521024e9ad7b50fbaa83cd2bd29ee8703 (diff)
downloadbcm5719-llvm-ece4bf5148f641d695458d252ce49bcb81b44571.tar.gz
bcm5719-llvm-ece4bf5148f641d695458d252ce49bcb81b44571.zip
Use the return value of getMagicNumber instead of using a
separate canRead() call. llvm-svn: 104853
Diffstat (limited to 'llvm/lib/Linker/LinkItems.cpp')
-rw-r--r--llvm/lib/Linker/LinkItems.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Linker/LinkItems.cpp b/llvm/lib/Linker/LinkItems.cpp
index 2c225503d61..f0c7b68e69b 100644
--- a/llvm/lib/Linker/LinkItems.cpp
+++ b/llvm/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:
OpenPOWER on IntegriCloud