[PATCH] D26199: [ELF] - Implemented threaded --build-id computation

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 11:07:29 PDT 2016


grimar added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:74-82
+  while (!Arr.empty()) {
+    if (Arr.size() <= ChunkSize) {
+      Ret.push_back(Arr);
+      break;
+    }
+    Ret.push_back(Arr.take_front(ChunkSize));
+    Arr = Arr.drop_front(ChunkSize);
----------------
ruiu wrote:
> This can be simplified.
> 
>   while (Arr.size() > ChunkSize) {
>     Ret.push_back(...);
>     Arr = Arr.drop_front...;
>   }
>   if (!Arr.empty())
>     Ret.push_back(Arr);
>   return Ret;
Done.


================
Comment at: ELF/SyntheticSections.cpp:88
+    llvm::ArrayRef<uint8_t> Data,
+    std::function<void(ArrayRef<uint8_t> Arr, uint8_t *Hash)> Cb) {
+  std::vector<ArrayRef<uint8_t>> Chunks = split(Data, 1024 * 1024);
----------------
ruiu wrote:
> Cb is not a good name. Let's name Hash.
Done.


================
Comment at: ELF/SyntheticSections.cpp:109
+void BuildIdFastHash<ELFT>::writeBuildId(MutableArrayRef<uint8_t> Buf) {
+  computeHash(Buf, [&](ArrayRef<uint8_t> Arr, uint8_t *Dest) {
+    uint64_t Hash = xxHash64(toStringRef(Arr));
----------------
ruiu wrote:
> Replace [&] with [] because I think it doesn't capture anything. (And ditto for other functions.)
Removed & here, but others lambdas below still needs to capture HashSize.


https://reviews.llvm.org/D26199





More information about the llvm-commits mailing list