aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FileCollector.cpp
diff options
context:
space:
mode:
authorJan Korous <jkorous@apple.com>2020-04-29 11:44:40 -0700
committerJan Korous <jkorous@apple.com>2020-04-29 11:47:23 -0700
commit4c53f4202a45266ac89ae240c05e2bdcbfc3308f (patch)
tree7553e4ee0165c3260a650e7f10e23bf2ce33637a /llvm/lib/Support/FileCollector.cpp
parent0700cb64b536972c25ef5bbbb764a4232e689abc (diff)
downloadllvm-4c53f4202a45266ac89ae240c05e2bdcbfc3308f.zip
llvm-4c53f4202a45266ac89ae240c05e2bdcbfc3308f.tar.gz
llvm-4c53f4202a45266ac89ae240c05e2bdcbfc3308f.tar.bz2
[FileCollector] move Root creation
If we don't handle the errors we can't rely on the directory being created early anyway. Differential Revision: https://reviews.llvm.org/D78959
Diffstat (limited to 'llvm/lib/Support/FileCollector.cpp')
-rw-r--r--llvm/lib/Support/FileCollector.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/FileCollector.cpp b/llvm/lib/Support/FileCollector.cpp
index e13a7b5..cb83d84 100644
--- a/llvm/lib/Support/FileCollector.cpp
+++ b/llvm/lib/Support/FileCollector.cpp
@@ -34,7 +34,6 @@ static bool isCaseSensitivePath(StringRef Path) {
FileCollector::FileCollector(std::string Root, std::string OverlayRoot)
: Root(std::move(Root)), OverlayRoot(std::move(OverlayRoot)) {
- sys::fs::create_directories(this->Root, true);
}
bool FileCollector::getRealPath(StringRef SrcPath,
@@ -150,6 +149,11 @@ copyAccessAndModificationTime(StringRef Filename,
}
std::error_code FileCollector::copyFiles(bool StopOnError) {
+ auto Err = sys::fs::create_directories(Root, /*IgnoreExisting=*/true);
+ if (Err) {
+ return Err;
+ }
+
std::lock_guard<std::mutex> lock(Mutex);
for (auto &entry : VFSWriter.getMappings()) {