aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix/PathV2.inc')
-rw-r--r--lib/Support/Unix/PathV2.inc45
1 files changed, 43 insertions, 2 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc
index d04f590f87..59c5ae5808 100644
--- a/lib/Support/Unix/PathV2.inc
+++ b/lib/Support/Unix/PathV2.inc
@@ -117,7 +117,9 @@ error_code current_path(SmallVectorImpl<char> &result) {
// For GNU Hurd
result.reserve(1024);
#endif
-
+#ifdef __native_client__
+ llvm_unreachable("current_path() not implemented for Native Client");
+#else
while (true) {
if (::getcwd(result.data(), result.capacity()) == 0) {
// See if there was a real error.
@@ -130,6 +132,7 @@ error_code current_path(SmallVectorImpl<char> &result) {
}
result.set_size(strlen(result.data()));
+#endif
return error_code::success();
}
@@ -193,6 +196,9 @@ error_code copy_file(const Twine &from, const Twine &to, copy_option copt) {
}
error_code create_directory(const Twine &path, bool &existed) {
+#ifdef __native_client__
+ llvm_unreachable("create_directory() not implemented for Native Client");
+#else
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
@@ -204,9 +210,13 @@ error_code create_directory(const Twine &path, bool &existed) {
existed = false;
return error_code::success();
+#endif
}
error_code create_hard_link(const Twine &to, const Twine &from) {
+#ifdef __native_client__
+ llvm_unreachable("create_hard_link() not implemented for Native Client");
+#else
// Get arguments.
SmallString<128> from_storage;
SmallString<128> to_storage;
@@ -217,9 +227,13 @@ error_code create_hard_link(const Twine &to, const Twine &from) {
return error_code(errno, system_category());
return error_code::success();
+#endif
}
error_code create_symlink(const Twine &to, const Twine &from) {
+#ifdef __native_client__
+ llvm_unreachable("create_symlink() not implemented for Native Client");
+#else
// Get arguments.
SmallString<128> from_storage;
SmallString<128> to_storage;
@@ -230,9 +244,13 @@ error_code create_symlink(const Twine &to, const Twine &from) {
return error_code(errno, system_category());
return error_code::success();
+#endif
}
error_code remove(const Twine &path, bool &existed) {
+#ifdef __native_client__
+ llvm_unreachable("remove() not implemented for Native Client");
+#else
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
@@ -242,11 +260,14 @@ error_code remove(const Twine &path, bool &existed) {
existed = false;
} else
existed = true;
-
return error_code::success();
+#endif
}
error_code rename(const Twine &from, const Twine &to) {
+#ifdef __native_client__
+ llvm_unreachable("rename() not implemented for Native Client");
+#else
// Get arguments.
SmallString<128> from_storage;
SmallString<128> to_storage;
@@ -266,9 +287,13 @@ error_code rename(const Twine &from, const Twine &to) {
}
return error_code::success();
+#endif
}
error_code resize_file(const Twine &path, uint64_t size) {
+#ifdef __native_client__
+ llvm_unreachable("resize_file() not implemented for Native Client");
+#else
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
@@ -276,6 +301,7 @@ error_code resize_file(const Twine &path, uint64_t size) {
return error_code(errno, system_category());
return error_code::success();
+#endif
}
error_code exists(const Twine &path, bool &result) {
@@ -390,6 +416,9 @@ error_code permissions(const Twine &path, perms prms) {
error_code unique_file(const Twine &model, int &result_fd,
SmallVectorImpl<char> &result_path,
bool makeAbsolute, unsigned mode) {
+#ifdef __native_client__
+ llvm_unreachable("unique_file() not implemented for Native Client");
+#else
SmallString<128> Model;
model.toVector(Model);
// Null terminate.
@@ -463,9 +492,14 @@ rety_open_create:
result_fd = RandomFD;
return error_code::success();
+#endif
}
error_code mapped_file_region::init(int fd, uint64_t offset) {
+#ifdef __native_client__
+ // Newlib does not have ftruncate.
+ llvm_unreachable("mapped_file_region not implemented for native client");
+#else
AutoFD FD(fd);
// Figure out how large the file is.
@@ -491,6 +525,7 @@ error_code mapped_file_region::init(int fd, uint64_t offset) {
if (Mapping == MAP_FAILED)
return error_code(errno, system_category());
return error_code::success();
+#endif // __native_client__
}
mapped_file_region::mapped_file_region(const Twine &path,
@@ -501,6 +536,9 @@ mapped_file_region::mapped_file_region(const Twine &path,
: Mode(mode)
, Size(length)
, Mapping() {
+#ifdef __native_client__
+ llvm_unreachable("mapped_file_region not implemented for native client");
+#endif
// Make sure that the requested size fits within SIZE_T.
if (length > std::numeric_limits<size_t>::max()) {
ec = make_error_code(errc::invalid_argument);
@@ -529,6 +567,9 @@ mapped_file_region::mapped_file_region(int fd,
: Mode(mode)
, Size(length)
, Mapping() {
+#ifdef __native_client__
+ llvm_unreachable("mapped_file_region not implemented for native client");
+#endif
// Make sure that the requested size fits within SIZE_T.
if (length > std::numeric_limits<size_t>::max()) {
ec = make_error_code(errc::invalid_argument);