[PATCH] D22560: [Profile] add support for reading directory as input for profile merging

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 11:55:46 PDT 2016


vsk added a comment.

Mostly looks good.


================
Comment at: tools/llvm-profdata/llvm-profdata.cpp:328
@@ +327,3 @@
+  llvm::sys::fs::status(Filename, Status);
+  if (llvm::sys::fs::exists(Status)) {
+    // If it's a source file, collect it.
----------------
Invert the check and exit early here to flatten the code a bit.

================
Comment at: tools/llvm-profdata/llvm-profdata.cpp:341
@@ +340,3 @@
+        }
+      }
+    }
----------------
Should we emit a warning if the loop exits due to an error?

================
Comment at: tools/llvm-profdata/llvm-profdata.cpp:412
@@ -389,3 +411,3 @@
   for (StringRef Filename : InputFilenames)
-    WeightedInputs.emplace_back(Filename, 1);
+    addWeightedInput(WeightedInputs, {Filename, 1});
   for (StringRef WeightedFilename : WeightedInputFilenames)
----------------
We might be able to get rid of some string copies here if we added a constructor to WeightedFile which accepts a `std::string&&`. We can clean that up later though.


https://reviews.llvm.org/D22560





More information about the llvm-commits mailing list