aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Path.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-09-15 22:45:45 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-09-15 22:45:45 +0000
commit8a26f818896c6a02ebdb11d624cb9ef39f082df2 (patch)
treedc91e85ae2647c9a957e936c516788ed5a02831c /lib/System/Path.cpp
parent765c4d947791c6d92532ff81b6d9649e237b2084 (diff)
System/Path: Add isObjectFile().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Path.cpp')
-rw-r--r--lib/System/Path.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp
index 4445c667d8..0026fd29df 100644
--- a/lib/System/Path.cpp
+++ b/lib/System/Path.cpp
@@ -156,6 +156,20 @@ Path::isDynamicLibrary() const {
return false;
}
+bool
+Path::isObjectFile() const {
+ std::string Magic;
+ if (getMagicNumber(Magic, 64))
+ if (IdentifyFileType(Magic.c_str(),
+ static_cast<unsigned>(Magic.length()))
+ != Unknown_FileType) {
+ // Everything in LLVMFileType is currently an object file.
+ return true;
+ }
+
+ return false;
+}
+
Path
Path::FindLibrary(std::string& name) {
std::vector<sys::Path> LibPaths;