diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4939680e909..026a2f9b119 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,9 +50,9 @@ jobs: strategy: matrix: # Test on the oldest support Ubuntu version in addition to `latest`. - # Build using the oldest support macOS version. For emsdk this is - # currently macos-13, but unfortunately that doesn't exist in github - # actions so we settle for macos-15. + # Build using the oldest macOS runner available on GitHub Actions. + # emsdk CI currently uses Xcode 15.4 (macOS 14), which is unavailable + # here, so we also test Clang 15 + libc++ in `build-clang-15`. os: [ubuntu-22.04, ubuntu-latest, macos-15, windows-latest, windows-11-arm] steps: - uses: actions/setup-python@v5 @@ -439,3 +439,28 @@ jobs: cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBYN_ENABLE_ASSERTIONS=OFF - name: build run: cmake --build out -v + + # Ensures compatibility with Clang 15 and libc++ 15 (matching Xcode 15.4 in + # emsdk CI, which uses Apple Clang 15). + build-clang-15: + name: clang-15 (libc++) + runs-on: ubuntu-22.04 + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install dependencies + run: | + sudo apt-get update + sudo apt-get install -y ninja-build clang-15 lld libc++-15-dev libc++abi-15-dev + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_CXX_FLAGS="-stdlib=libc++" + - name: build + run: cmake --build out -v + - name: unittest + run: ./out/bin/binaryen-unittests diff --git a/src/dataflow/node.h b/src/dataflow/node.h index c529f2040c2..8f403ddef77 100644 --- a/src/dataflow/node.h +++ b/src/dataflow/node.h @@ -167,7 +167,7 @@ struct Node { } } - bool operator==(const Node& other) { + bool operator==(const Node& other) const { if (type != other.type) { return false; } @@ -201,7 +201,7 @@ struct Node { return true; } - bool operator!=(const Node& other) { return !(*this == other); } + bool operator!=(const Node& other) const { return !(*this == other); } // As mentioned above, comparisons return i1. This checks // if an operation is of that sort. diff --git a/src/passes/Unsubtyping.cpp b/src/passes/Unsubtyping.cpp index cc6b2251fd9..d91ebe5c5ca 100644 --- a/src/passes/Unsubtyping.cpp +++ b/src/passes/Unsubtyping.cpp @@ -362,10 +362,12 @@ struct TypeTree { // DFS stack of (node index, child index) pairs. std::vector> stack; - bool operator==(const SubtypeIterator& other) { + bool operator==(const SubtypeIterator& other) const { return stack == other.stack; } - bool operator!=(const SubtypeIterator& other) { return !(*this == other); } + bool operator!=(const SubtypeIterator& other) const { + return !(*this == other); + } const HeapType& operator*() const { return parent->nodes[stack.back().first].type; } diff --git a/src/wasm.h b/src/wasm.h index e8ac45b3abe..751ac562cfd 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -2468,6 +2468,13 @@ class Function : public Importable { lineNumber = BinaryLocation(-1), columnNumber = BinaryLocation(-1); std::optional symbolNameIndex; + DebugLocation() = default; + DebugLocation(BinaryLocation fileIndex, + BinaryLocation lineNumber, + BinaryLocation columnNumber, + std::optional symbolNameIndex = std::nullopt) + : fileIndex(fileIndex), lineNumber(lineNumber), + columnNumber(columnNumber), symbolNameIndex(symbolNameIndex) {} bool operator==(const DebugLocation& other) const { return fileIndex == other.fileIndex && lineNumber == other.lineNumber && columnNumber == other.columnNumber &&