Skip to content

Commit

Permalink
Workaround clang-format error in standard.c++
Browse files Browse the repository at this point in the history
  • Loading branch information
danlapid committed Aug 9, 2024
1 parent 82c8a62 commit 313d830
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/workerd/api/streams/standard.c++
Original file line number Diff line number Diff line change
Expand Up @@ -3638,12 +3638,12 @@ jsg::Promise<void> WritableStreamJsController::pipeLoop(jsg::Lock& js) {
return pipeLoop(js);
}

auto onSuccess = JSG_VISITABLE_LAMBDA(
auto onSuccess = JSG_VISITABLE_LAMBDA2(
(this, ref=addRef()), (ref), (jsg::Lock& js) {
return pipeLoop(js);
});

auto onFailure = JSG_VISITABLE_LAMBDA(
auto onFailure = JSG_VISITABLE_LAMBDA2(
(ref=addRef(),&source, preventCancel, pipeThrough),
(ref), (jsg::Lock& js, jsg::Value value) {
// The write failed. We handle it here because the pipe lock will have been released.
Expand Down
5 changes: 5 additions & 0 deletions src/workerd/jsg/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,4 +519,9 @@ template <> constexpr bool isGcVisitor<GcVisitor&>() { return true; }
} \
})

// Clang format encounters a segfault when JSG_VISITABLE_LAMBDA is called from inside of a
// JSG_VISITABLE_LAMBDA, if we call JSG_VISITABLE_LAMBDA through JSG_VISITABLE_LAMBDA2 it works.
#define JSG_VISITABLE_LAMBDA2(CAPTURES, VISITS, ...) JSG_VISITABLE_LAMBDA(CAPTURES, VISITS, __VA_ARGS__)


} // namespace workerd::jsg

0 comments on commit 313d830

Please sign in to comment.