return EC;
}
- return error_code::success();
+ return error_code();
}
case FS_Name: {
return EC;
if (Exists)
goto retry_random_path;
- return error_code::success();
+ return error_code();
}
case FS_Dir: {
goto retry_random_path;
return EC;
}
- return error_code::success();
+ return error_code();
}
}
llvm_unreachable("Invalid Type");
}
const_iterator &const_iterator::operator--() {
- // If we're at the end and the previous char was a '/', return '.'.
+ // If we're at the end and the previous char was a '/', return '.' unless
+ // we are the root path.
+ size_t root_dir_pos = root_dir_start(Path);
if (Position == Path.size() &&
- Path.size() > 1 &&
- is_separator(Path[Position - 1])
-#ifdef LLVM_ON_WIN32
- && Path[Position - 2] != ':'
-#endif
- ) {
+ Path.size() > root_dir_pos + 1 &&
+ is_separator(Path[Position - 1])) {
--Position;
Component = ".";
return *this;
}
// Skip separators unless it's the root directory.
- size_t root_dir_pos = root_dir_start(Path);
size_t end_pos = Position;
while(end_pos > 0 &&
}
}
+static const char preferred_separator_string[] = { preferred_separator, '\0' };
+
+const StringRef get_separator() {
+ return preferred_separator_string;
+}
+
void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result) {
result.clear();
// macros defined in <unistd.h> on darwin >= 9
int ConfName = erasedOnReboot? _CS_DARWIN_USER_TEMP_DIR
: _CS_DARWIN_USER_CACHE_DIR;
- size_t ConfLen = confstr(ConfName, 0, 0);
+ size_t ConfLen = confstr(ConfName, nullptr, 0);
if (ConfLen > 0) {
do {
result.resize(ConfLen);
if (EC)
return EC;
Result = Status.getUniqueID();
- return error_code::success();
+ return error_code();
}
error_code createUniqueFile(const Twine &Model, int &ResultFd,
// Already absolute.
if (rootName && rootDirectory)
- return error_code::success();
+ return error_code();
// All of the following conditions will need the current directory.
SmallString<128> current_dir;
path::append(current_dir, p);
// Set path to the result.
path.swap(current_dir);
- return error_code::success();
+ return error_code();
}
if (!rootName && rootDirectory) {
path::append(curDirRootName, p);
// Set path to the result.
path.swap(curDirRootName);
- return error_code::success();
+ return error_code();
}
if (rootName && !rootDirectory) {
SmallString<128> res;
path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath);
path.swap(res);
- return error_code::success();
+ return error_code();
}
llvm_unreachable("All rootName and rootDirectory combinations should have "
if (error_code ec = status(path, st))
return ec;
result = is_directory(st);
- return error_code::success();
+ return error_code();
}
bool is_regular_file(file_status status) {
if (error_code ec = status(path, st))
return ec;
result = is_regular_file(st);
- return error_code::success();
-}
-
-bool is_symlink(file_status status) {
- return status.type() == file_type::symlink_file;
-}
-
-error_code is_symlink(const Twine &path, bool &result) {
- file_status st;
- if (error_code ec = status(path, st))
- return ec;
- result = is_symlink(st);
- return error_code::success();
+ return error_code();
}
bool is_other(file_status status) {
return exists(status) &&
!is_regular_file(status) &&
- !is_directory(status) &&
- !is_symlink(status);
+ !is_directory(status);
}
void directory_entry::replace_filename(const Twine &filename, file_status st) {
if (ec == errc::value_too_large) {
// Magic.size() > file_size(Path).
result = false;
- return error_code::success();
+ return error_code();
}
return ec;
}
result = Magic == Buffer;
- return error_code::success();
+ return error_code();
}
/// @brief Identify the magic in magic.
case 0x66: // MPS R4000 Windows
case 0x50: // mc68K
case 0x4c: // 80386 Windows
+ case 0xc4: // ARMNT Windows
if (Magic[1] == 0x01)
return file_magic::coff_object;
return ec;
result = identify_magic(Magic);
- return error_code::success();
+ return error_code();
}
error_code directory_entry::status(file_status &result) const {