From 932daad34a49bba98e41310328cb80e5bc0a39e0 Mon Sep 17 00:00:00 2001 From: Dan Lapid Date: Fri, 9 Aug 2024 17:38:15 +0100 Subject: [PATCH] Workaround clang-format error in standard.c++ --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- src/workerd/api/streams/standard.c++ | 4 ++-- src/workerd/jsg/function.h | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d81fc88b5c..81756674c57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b90dedd41f..abb341f9a90 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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' diff --git a/src/workerd/api/streams/standard.c++ b/src/workerd/api/streams/standard.c++ index c318d6d18f3..44b8ab1c49c 100644 --- a/src/workerd/api/streams/standard.c++ +++ b/src/workerd/api/streams/standard.c++ @@ -3638,12 +3638,12 @@ jsg::Promise 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. diff --git a/src/workerd/jsg/function.h b/src/workerd/jsg/function.h index 7a8a7c983e9..bb56a991f1c 100644 --- a/src/workerd/jsg/function.h +++ b/src/workerd/jsg/function.h @@ -519,4 +519,9 @@ template <> constexpr bool isGcVisitor() { 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