[PATCH] D76671: [FileCollector] Add a method to add a whole directory and it contents.

Alex Lorenz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 14:53:48 PDT 2020


arphaman added a comment.

LGTM with one comment that needs to be fixed



================
Comment at: llvm/lib/Support/FileCollector.cpp:232
     // Collect everything that's listed in case the user needs it.
-    Collector->addFile(Dir);
-    for (; !EC && It != llvm::vfs::directory_iterator(); It.increment(EC)) {
-      if (It->type() == sys::fs::file_type::regular_file ||
-          It->type() == sys::fs::file_type::directory_file ||
-          It->type() == sys::fs::file_type::symlink_file) {
-        Collector->addFile(It->path());
-      }
-    }
-    if (EC)
-      return It;
+    Collector->addDirectory(Dir);
+
----------------
Could you also propagate the error to `addDirectory` and return early from this function if `EC` is set?


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

https://reviews.llvm.org/D76671





More information about the llvm-commits mailing list