[PATCH] D78959: [WIP][FileCollector] move Root creation

Jan Korous via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 11:51:09 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4c53f4202a45: [FileCollector] move Root creation (authored by jkorous).

Changed prior to commit:
  https://reviews.llvm.org/D78959?vs=260417&id=260977#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78959/new/

https://reviews.llvm.org/D78959

Files:
  llvm/include/llvm/Support/FileCollector.h
  llvm/lib/Support/FileCollector.cpp


Index: llvm/lib/Support/FileCollector.cpp
===================================================================
--- llvm/lib/Support/FileCollector.cpp
+++ llvm/lib/Support/FileCollector.cpp
@@ -34,7 +34,6 @@
 
 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 @@
 }
 
 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()) {
Index: llvm/include/llvm/Support/FileCollector.h
===================================================================
--- llvm/include/llvm/Support/FileCollector.h
+++ llvm/include/llvm/Support/FileCollector.h
@@ -23,6 +23,7 @@
 /// the VFS.
 class FileCollector {
 public:
+  /// \p Root directory gets created in copyFiles unless it already exists.
   FileCollector(std::string Root, std::string OverlayRoot);
 
   void addFile(const Twine &file);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78959.260977.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200429/08e269e8/attachment.bin>


More information about the llvm-commits mailing list