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 932daad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Setup macOS
if: runner.os == 'macOS'
run: |
sudo brew install llvm@18
brew install llvm@18
export PATH="$(brew --prefix llvm@18)/bin/bin:$PATH"
- name: Setup Windows
if: runner.os == 'Windows'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Setup macOS
if: matrix.os.name == 'macOS'
run: |
sudo brew install llvm@18
brew install llvm@18
export PATH="$(brew --prefix llvm@18)/bin/bin:$PATH"
- name: Setup Windows
if: matrix.os.name == 'windows'
Expand Down
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 932daad

Please sign in to comment.