[PATCH] D19494: [ELF] Introduce --reproduce flag

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 16:58:20 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/Driver.cpp:102-103
@@ +101,4 @@
+static void dumpFile(StringRef SrcPath) {
+  std::error_code EC;
+
+  SmallString<128> DirName;
----------------
Remove.

================
Comment at: ELF/Driver.cpp:105
@@ +104,3 @@
+  SmallString<128> DirName;
+  llvm::sys::path::append(DirName, Config->Reproduce, llvm::sys::path::parent_path(SrcPath));
+  EC = llvm::sys::fs::create_directories(DirName);
----------------
Please do not add `llvm::` for consistency.

================
Comment at: ELF/Driver.cpp:106-107
@@ +105,4 @@
+  llvm::sys::path::append(DirName, Config->Reproduce, llvm::sys::path::parent_path(SrcPath));
+  EC = llvm::sys::fs::create_directories(DirName);
+  if (EC) {
+    error("--reproduce: can't create directory");
----------------
  if (std::error_code EC = sys::fs::create_directories(DirName))

================
Comment at: ELF/Driver.cpp:108
@@ +107,3 @@
+  if (EC) {
+    error("--reproduce: can't create directory");
+    return;
----------------
Please pass EC as the first argument at this place too.

================
Comment at: ELF/Driver.cpp:114-115
@@ +113,4 @@
+  llvm::sys::path::append(DestPathName, Config->Reproduce, SrcPath);
+  EC = llvm::sys::fs::copy_file(SrcPath, DestPathName);
+  if (EC)
+    error(EC, "--reproduce: can't copy file");
----------------
  if (std::error_code EC = sys::fs::copy_file(SrcPath, DestPathName))

================
Comment at: ELF/Driver.cpp:256
@@ +255,3 @@
+
+  raw_fd_ostream OS(Config->Reproduce + "/invocation.txt", EC,
+    sys::fs::OpenFlags::F_None);
----------------
Please fix this place as well. You want to use sys::path::append instead of textually appending path fragments.

================
Comment at: ELF/Driver.cpp:261
@@ +260,3 @@
+  unsigned Size = Args.size();
+  for (unsigned I = 0; I < Size; ++I) {
+    OS << Args[I];
----------------
I'd do this (because ARGV[0] must exist)

  OS << Args[0];
  for (size_t I = 1, E = Args.size(); I < E; ++I)
    OS << " " << Args[I];
  OS << "\n";


http://reviews.llvm.org/D19494





More information about the llvm-commits mailing list