NoQ added a comment.

In D70725#1765981 <https://reviews.llvm.org/D70725#1765981>, @xazax.hun wrote:

> the same call might both acquire and release handles (there are such calls in 
> Fuchsia), so we might end up adding more than one note for a call for which 
> we would need to add more than one transitions


Hmm, would this be too functional?:

  std::vector<std::function> notes;
  for (arg : args) {
    if (isAcquired(param)) {
      State = State->set(arg, Acquired);
      notes.push_back([](Report) {
        if (Report.isInteresting(arg))
          return "Handle acquired here";
      });
    }
    if (isReleased(param)) {
      State = State->set(arg, Released);
      notes.push_back([](Report) {
        if (Report.isInteresting(arg))
          return "Handle released here";
      });
    }
  }
  
  C.addTransition(State, C.getNoteTag(
      // We might as well add a C.getNoteTag() overload
      // to do this automatically.
      [std::move(notes)](Report) {
        for (note : notes)
          note();
      }));

Or, well, yeah, chain the nodes together; you anyway have to do this 
occasionally due to clumsiness of the rest of the API.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70725



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to