summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-16 02:55:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-16 02:55:33 +0000
commit9da91a0e03af28eab74be172cd601c5149ae5d0e (patch)
tree10f1367fbe7552a43cba4acd3c8515dc489672fa /llvm/lib/Support/Unix
parentbe2978b2e4326b60351aa6bc5a6cfbe679d9ce26 (diff)
downloadbcm5719-llvm-9da91a0e03af28eab74be172cd601c5149ae5d0e.tar.gz
bcm5719-llvm-9da91a0e03af28eab74be172cd601c5149ae5d0e.zip
Instead friending status, provide windows and posix constructors to file_status.
This opens the way of having static helpers in the .inc files that can construct a file_status. llvm-svn: 186376
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc28
1 files changed, 12 insertions, 16 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 83879ff68d1..484296cdee7 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -556,28 +556,24 @@ error_code status(const Twine &path, file_status &result) {
}
perms prms = static_cast<perms>(status.st_mode);
-
+ file_type Type = file_type::type_unknown;
+
if (S_ISDIR(status.st_mode))
- result = file_status(file_type::directory_file, prms);
+ Type = file_type::directory_file;
else if (S_ISREG(status.st_mode))
- result = file_status(file_type::regular_file, prms);
+ Type = file_type::regular_file;
else if (S_ISBLK(status.st_mode))
- result = file_status(file_type::block_file, prms);
+ Type = file_type::block_file;
else if (S_ISCHR(status.st_mode))
- result = file_status(file_type::character_file, prms);
+ Type = file_type::character_file;
else if (S_ISFIFO(status.st_mode))
- result = file_status(file_type::fifo_file, prms);
+ Type = file_type::fifo_file;
else if (S_ISSOCK(status.st_mode))
- result = file_status(file_type::socket_file, prms);
- else
- result = file_status(file_type::type_unknown, prms);
-
- result.fs_st_dev = status.st_dev;
- result.fs_st_ino = status.st_ino;
- result.fs_st_mtime = status.st_mtime;
- result.fs_st_uid = status.st_uid;
- result.fs_st_gid = status.st_gid;
- result.fs_st_size = status.st_size;
+ Type = file_type::socket_file;
+
+ result =
+ file_status(Type, prms, status.st_dev, status.st_ino, status.st_mtime,
+ status.st_uid, status.st_gid, status.st_size);
return error_code::success();
}
OpenPOWER on IntegriCloud