|
@@ -849,9 +849,8 @@ getPotentiallyUniqueTempFileName(const Twine &Prefix, StringRef Suffix,
|
|
|
return createTemporaryFile(Prefix, Suffix, Dummy, ResultPath, FS_Name);
|
|
|
}
|
|
|
|
|
|
-static std::error_code make_absolute(const Twine ¤t_directory,
|
|
|
- SmallVectorImpl<char> &path,
|
|
|
- bool use_current_directory) {
|
|
|
+void make_absolute(const Twine ¤t_directory,
|
|
|
+ SmallVectorImpl<char> &path) {
|
|
|
StringRef p(path.data(), path.size());
|
|
|
|
|
|
bool rootDirectory = path::has_root_directory(p);
|
|
@@ -860,14 +859,11 @@ static std::error_code make_absolute(const Twine ¤t_directory,
|
|
|
|
|
|
// Already absolute.
|
|
|
if (rootName && rootDirectory)
|
|
|
- return std::error_code();
|
|
|
+ return;
|
|
|
|
|
|
// All of the following conditions will need the current directory.
|
|
|
SmallString<128> current_dir;
|
|
|
- if (use_current_directory)
|
|
|
- current_directory.toVector(current_dir);
|
|
|
- else if (std::error_code ec = current_path(current_dir))
|
|
|
- return ec;
|
|
|
+ current_directory.toVector(current_dir);
|
|
|
|
|
|
// Relative path. Prepend the current directory.
|
|
|
if (!rootName && !rootDirectory) {
|
|
@@ -875,7 +871,7 @@ static std::error_code make_absolute(const Twine ¤t_directory,
|
|
|
path::append(current_dir, p);
|
|
|
// Set path to the result.
|
|
|
path.swap(current_dir);
|
|
|
- return std::error_code();
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (!rootName && rootDirectory) {
|
|
@@ -884,7 +880,7 @@ static std::error_code make_absolute(const Twine ¤t_directory,
|
|
|
path::append(curDirRootName, p);
|
|
|
// Set path to the result.
|
|
|
path.swap(curDirRootName);
|
|
|
- return std::error_code();
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (rootName && !rootDirectory) {
|
|
@@ -896,20 +892,23 @@ static std::error_code make_absolute(const Twine ¤t_directory,
|
|
|
SmallString<128> res;
|
|
|
path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath);
|
|
|
path.swap(res);
|
|
|
- return std::error_code();
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
llvm_unreachable("All rootName and rootDirectory combinations should have "
|
|
|
"occurred above!");
|
|
|
}
|
|
|
|
|
|
-std::error_code make_absolute(const Twine ¤t_directory,
|
|
|
- SmallVectorImpl<char> &path) {
|
|
|
- return make_absolute(current_directory, path, true);
|
|
|
-}
|
|
|
-
|
|
|
std::error_code make_absolute(SmallVectorImpl<char> &path) {
|
|
|
- return make_absolute(Twine(), path, false);
|
|
|
+ if (path::is_absolute(path))
|
|
|
+ return {};
|
|
|
+
|
|
|
+ SmallString<128> current_dir;
|
|
|
+ if (std::error_code ec = current_path(current_dir))
|
|
|
+ return ec;
|
|
|
+
|
|
|
+ make_absolute(current_dir, path);
|
|
|
+ return {};
|
|
|
}
|
|
|
|
|
|
std::error_code create_directories(const Twine &Path, bool IgnoreExisting,
|