[PATCH] D139067: [FuzzMutate] New InsertCFGStrategy

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 11:07:58 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:365-374
+    for (uint64_t i = 0; i < NumCases; i++) {
+      uint64_t CaseVal = [&CaseVals, MaxCaseVal, &IB]() {
+        uint64_t tmp;
+        // Make sure we don't have two cases with same value.
+        do {
+          tmp = uniform<uint64_t>(IB.Rand, 0, MaxCaseVal);
+        } while (CaseVals.count(tmp) != 0);
----------------
Peter wrote:
> arsenm wrote:
> > Why is this a lambda here?
> Just to enclose unnecessary variables(`tmp` required to make CaseVal unique. I can write the loop outside the lambda if you want to.
A lambda with no arguments is weird, especially with the placement. Could just be a separate function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139067



More information about the llvm-commits mailing list