Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7133133
Add make_shared_task
JoshuaRowePhantom Oct 3, 2025
0e5a30b
Add text tracing skeleton
JoshuaRowePhantom Oct 27, 2025
9880f27
Rewrite uses of conflicted_name for latest Msvc
JoshuaRowePhantom Nov 16, 2025
51a2ba0
Fix missing "template" keywords
JoshuaRowePhantom Nov 16, 2025
413d6da
Add missing #include
JoshuaRowePhantom Nov 16, 2025
65edb99
Add missing template keywords
JoshuaRowePhantom Nov 16, 2025
f2d07ea
Make things work on Msvc 14.50.35717
JoshuaRowePhantom Nov 16, 2025
6b21bdb
Working test for traces_create_and_destroy_promise
JoshuaRowePhantom Dec 19, 2025
481d111
Make traces_initial_suspend test work
JoshuaRowePhantom Dec 19, 2025
8e63340
traces_final_suspend test works
JoshuaRowePhantom Dec 19, 2025
7b760cb
Add expect_events_equal to traces_final_suspend, traces_initial_suspe…
JoshuaRowePhantom Dec 20, 2025
f1aaae0
Added tracing_tests traces_await_ready_exception
JoshuaRowePhantom Dec 20, 2025
f8eeab8
Added tracing_tests traces_await_suspend_exception
JoshuaRowePhantom Dec 20, 2025
f559ad8
Added tracing_tests traces_await_resume_exception
JoshuaRowePhantom Dec 20, 2025
871d4ab
Add test for traces_return_value
JoshuaRowePhantom Dec 20, 2025
320f171
Added test traces_return_value_exception
JoshuaRowePhantom Dec 20, 2025
0c407b9
Added tracing_tests traces_unhandled_exception
JoshuaRowePhantom Dec 20, 2025
a852757
Expose derived_promise_construction
JoshuaRowePhantom Dec 22, 2025
1fd48e9
Add is_empty_type_list
JoshuaRowePhantom Dec 22, 2025
0f98dc5
Refactor construction of thread_local_contextual_promise
JoshuaRowePhantom Dec 22, 2025
c0ef1dc
Refactor tracing promise and add return/void tests
JoshuaRowePhantom Dec 22, 2025
2a136df
Add no_unique_address config macro
JoshuaRowePhantom Dec 23, 2025
fdafd36
Export more things from std::
JoshuaRowePhantom Dec 23, 2025
268f8d5
Use correct type qualification in contextual_promise
JoshuaRowePhantom Dec 23, 2025
b585255
Add PHANTOM_COROUTINES_MSVC_INCORRECTLY_COPIES_CO_AWAIT_RVALUE_REFERE…
JoshuaRowePhantom Dec 24, 2025
f473340
value_awaiter now return references where possible
JoshuaRowePhantom Dec 24, 2025
c071ddb
Add missing import and includes and use Phantom::Coroutines versions …
JoshuaRowePhantom Dec 24, 2025
a86a07f
Use PHANTOM_COROUTINES_MSVC_INCORRECTLY_COPIES_CO_AWAIT_RVALUE_REFERE…
JoshuaRowePhantom Dec 24, 2025
649aa34
Move awaiter_wrapper_test, awaiters out of detail
JoshuaRowePhantom Dec 24, 2025
21e2135
Use operator co_await in get_awaiter on simple awaiters that also hav…
JoshuaRowePhantom Dec 24, 2025
f236a8b
awaiter_wrapper invokes co_await on is_awaiter objects that have oper…
JoshuaRowePhantom Dec 24, 2025
f8b0b1c
Add test tracing_tests::trace_return_value_moves_value
JoshuaRowePhantom Dec 24, 2025
d81aa71
Fix value_await_test compilation under clang
JoshuaRowePhantom Dec 24, 2025
a1a473b
Add missing #include<exception>
JoshuaRowePhantom Dec 24, 2025
d0792f1
Fix missing global module fragment
JoshuaRowePhantom Dec 24, 2025
2118901
Add tracing return value capability for non-copyable non-movable types
JoshuaRowePhantom Dec 24, 2025
fba5594
Fix tracing / functional build errors
JoshuaRowePhantom Apr 7, 2026
d573eb4
Add a BUILDING.md file and copilot instructions
JoshuaRowePhantom Apr 7, 2026
5ad6617
Fix filtered trace sink query propagation and correct test expectations
JoshuaRowePhantom Apr 7, 2026
3f7b8c5
Add traces_yield_value, traces_yield_value_exception, traces_should_t…
JoshuaRowePhantom Apr 7, 2026
54f59e1
Add traces_unhandled_exception_exception test
JoshuaRowePhantom Apr 7, 2026
3d2d4c6
Add await_transform event emission and tests
JoshuaRowePhantom Apr 7, 2026
1db9f19
Add get_return_object event emission and tests
JoshuaRowePhantom Apr 7, 2026
4fc1741
Add should_capture_promise_creation_arguments query and tests
JoshuaRowePhantom Apr 8, 2026
4081a2d
Add tests for suppress_trace and trace
JoshuaRowePhantom Apr 8, 2026
a18b67c
Add GitHub Actions workflow wrappers
JoshuaRowePhantom Apr 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copilot Instructions

## Build Configuration

**Always use debug builds when developing and testing.** Use the appropriate debug preset for your platform:

- **MSVC on Windows:** `msvc-windows-x64-debug`
- **Clang on Windows:** `clang-windows-x64-debug` (or `clang-windows-x64-debug-local` if using `CMakeUserPresets.json`)
- **Clang on Linux:** `clang-linux-x64-debug` (or `clang-linux-x64-debug-local` if using `CMakeUserPresets.json`)

Debug builds enable AddressSanitizer (`/fsanitize=address`) on MSVC, which helps catch memory errors during development.

**All build and test commands must be run from a Visual Studio 2026 Developer PowerShell session.** Load it with:

```powershell
Import-Module "C:\Program Files\Microsoft Visual Studio\18\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\18\Enterprise" -Arch amd64 -SkipAutomaticLocation
```

See [BUILDING.md](../BUILDING.md) for full build instructions.

## Project Overview

Phantom.Coroutines is a C++23 coroutine library with two implementation options:

- **Header-only:** include headers from `Phantom.Coroutines/include/`
- **C++ Modules:** build and link against the `Phantom.Coroutines.Modules` CMake target

Tests are in `Phantom.Coroutines.Test/` and cppcoro-compatibility tests in `Phantom.Coroutines.cppcoro.Test/`.

## Testing

### During development (iterative)

Build and run only the C++ modules implementation and its tests. This is faster and catches most issues:

```
cmake --build --preset msvc-windows-x64-debug --target Phantom.Coroutines.Modules.Test
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.Modules.Test.exe
```

### When a task is complete (full suite)

Build everything and run all three test executables:

```
cmake --build --preset msvc-windows-x64-debug
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.Test.exe
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.Modules.Test.exe
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.SingleModule.Test.exe
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.cppcoro.Test\Phantom.Coroutines.cppcoro.Test.exe
```

All PRs must include unit tests. Follow the existing naming style: descriptive test names with single-purpose assertions.
21 changes: 21 additions & 0 deletions .github/workflows/ok-to-test-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ok-to-test command

on:
issue_comment:
types:
- created

permissions:
contents: read
issues: write
pull-requests: write

jobs:
ok-to-test:
if: >
github.event.issue.pull_request &&
(github.event.comment.body == '/ok-to-test' ||
github.event.comment.body == '/remove-ok-to-test')
uses: JoshuaRowePhantom/Phantom.ContinuousIntegration/.github/workflows/ok-to-test-command.yml@main
with:
repository-profile: Phantom.Coroutines
21 changes: 21 additions & 0 deletions .github/workflows/pull-request-continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pull Request Continuous Integration

on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
- ready_for_review

permissions:
contents: read
id-token: write

jobs:
pull-request-continuous-integration:
uses: JoshuaRowePhantom/Phantom.ContinuousIntegration/.github/workflows/pull-request-continuous-integration.yml@main
with:
repository-profile: Phantom.Coroutines
21 changes: 21 additions & 0 deletions .github/workflows/pull-request-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pull Request Gate

on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
- ready_for_review

permissions:
contents: read
pull-requests: write

jobs:
continuous-integration-eligibility:
uses: JoshuaRowePhantom/Phantom.ContinuousIntegration/.github/workflows/pull-request-gate.yml@main
with:
repository-profile: Phantom.Coroutines
99 changes: 99 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Building Phantom.Coroutines

Phantom.Coroutines uses [CMake](https://cmake.org/) (3.30+) with [vcpkg](https://vcpkg.io/) for dependency management and [Ninja](https://ninja-build.org/) as the build generator.

## Prerequisites

- CMake 3.30 or later
- Ninja
- vcpkg (set `VCPKG_ROOT` environment variable to your vcpkg installation)
- A supported compiler:
- **Windows:** MSVC (Visual Studio 2026 or later) or Clang
- **Linux:** Clang 21

## Configure

Use a CMake preset to configure. For development, prefer a **debug** preset:

```
cmake --preset msvc-windows-x64-debug
```

Available presets (defined in `CMakePresets.json`):

| Preset | Platform | Compiler | Config |
|---|---|---|---|
| `msvc-windows-x64-debug` | Windows | MSVC | Debug |
| `msvc-windows-x64-release` | Windows | MSVC | RelWithDebInfo |
| `clang-windows-x64-debug` | Windows | Clang | Debug |
| `clang-windows-x64-release` | Windows | Clang | RelWithDebInfo |
| `clang-linux-x64-debug` | Linux | Clang 21 | Debug |
| `clang-linux-x64-release` | Linux | Clang 21 | RelWithDebInfo |

> **Note:** The release configuration is `RelWithDebInfo` (not `Release`). It enables link-time code generation (`/GL`/`/LTCG`) on MSVC.

> **Note:** Debug builds on MSVC enable AddressSanitizer (`/fsanitize=address`).

### Local overrides

`CMakeUserPresets.json` provides `*-local` variants of the Clang presets that hard-code local compiler paths. Copy and adapt as needed for your machine.

## Build

```
cmake --build --preset msvc-windows-x64-debug
```

Replace the preset name to match your configured preset.

## Run Tests

```
ctest --preset msvc-windows-x64-debug-unit
```

Test presets mirror the configure presets. Tests take roughly 5 seconds to run.

## Visual Studio

Open the repository folder in Visual Studio. It will detect `CMakePresets.json` automatically. Select a preset from the configuration drop-down and build/run tests from the IDE.

## Building with VS2026 PowerShell

From a **Visual Studio 2026 Developer PowerShell** session, cmake, ninja, cl, and the Windows SDK are all on `PATH` and the MSVC environment variables (`INCLUDE`, `LIB`) are set correctly. Use the VS Developer PowerShell shortcut, or load it yourself:

```powershell
Import-Module "C:\Program Files\Microsoft Visual Studio\18\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\18\Enterprise" -Arch amd64 -SkipAutomaticLocation
```

Then configure (only needed once, or after clearing the cache):

```powershell
cmake --preset msvc-windows-x64-debug
```

Build the C++ modules test target (iterative development):

```powershell
cmake --build --preset msvc-windows-x64-debug --target Phantom.Coroutines.Modules.Test
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.Modules.Test.exe
```

Full build and test suite (run when done with a task):

```powershell
cmake --build --preset msvc-windows-x64-debug
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.Test.exe
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.Modules.Test.exe
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.Test\Phantom.Coroutines.SingleModule.Test.exe
.\out\build\msvc-windows-x64-debug\Phantom.Coroutines.cppcoro.Test\Phantom.Coroutines.cppcoro.Test.exe
```

> **Note:** Use the test executables directly rather than `ctest`, as ctest spawns each test case as a separate process which is slow with AddressSanitizer enabled.

> **Note:** If configure fails with `Could NOT find GTest`, delete `out\build\msvc-windows-x64-debug\CMakeCache.txt` and re-run configure. This can happen when the build directory was previously configured with a different toolchain.

## C++ Modules

The `Phantom.Coroutines.Modules` target builds C++ module support. Module linking is disabled for Clang builds (`DISABLE_LINK_MODULES=ON`) and can be disabled entirely with `-DDISABLE_COMPILE_MODULES=ON`.
36 changes: 35 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@
}
}
],
"buildPresets": [
{
"name": "msvc-windows-x64-debug",
"configurePreset": "msvc-windows-x64-debug"
},
{
"name": "msvc-windows-x64-release",
"configurePreset": "msvc-windows-x64-release"
},
{
"name": "clang-windows-x64-debug",
"configurePreset": "clang-windows-x64-debug"
},
{
"name": "clang-windows-x64-release",
"configurePreset": "clang-windows-x64-release"
},
{
"name": "clang-linux-x64-debug",
"configurePreset": "clang-linux-x64-debug"
},
{
"name": "clang-linux-x64-release",
"configurePreset": "clang-linux-x64-release"
}
],
"testPresets": [
{
"name": "msvc-windows-x64-debug-unit",
Expand All @@ -132,6 +158,14 @@
"name": "msvc-windows-x64-release-unit",
"configurePreset": "msvc-windows-x64-release"
},
{
"name": "clang-windows-x64-debug-unit",
"configurePreset": "clang-windows-x64-debug"
},
{
"name": "clang-windows-x64-release-unit",
"configurePreset": "clang-windows-x64-release"
},
{
"name": "clang-linux-x64-debug-unit",
"configurePreset": "clang-linux-x64-debug"
Expand All @@ -141,4 +175,4 @@
"configurePreset": "clang-linux-x64-release"
}
]
}
}
Loading