Skip to content

Commit 662b553

Browse files
authored
Merge pull request #35620 from mikeash/debug-var-async-task-metadata
[Concurrency] Add a debug variable pointing to the metadata for AsyncTask.
2 parents f0791b8 + 329af74 commit 662b553

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Diff for: stdlib/public/Concurrency/Debug.h

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===--- Debug.h - Swift Concurrency debug helpers --------------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// Debugging and inspection support.
14+
//
15+
//===----------------------------------------------------------------------===//
16+
17+
#ifndef SWIFT_CONCURRENCY_DEBUG_H
18+
#define SWIFT_CONCURRENCY_DEBUG_H
19+
20+
#include "swift/Runtime/Config.h"
21+
22+
namespace swift {
23+
24+
/// The metadata pointer used for async task objects.
25+
SWIFT_RUNTIME_STDLIB_SPI
26+
const void *const _swift_concurrency_debug_asyncTaskMetadata;
27+
28+
} // namespace swift
29+
30+
#endif

Diff for: stdlib/public/Concurrency/Task.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "swift/Runtime/HeapObject.h"
2222
#include "TaskPrivate.h"
2323
#include "AsyncCall.h"
24+
#include "Debug.h"
2425

2526
#include <dispatch/dispatch.h>
2627

@@ -168,6 +169,9 @@ static FullMetadata<HeapMetadata> taskHeapMetadata = {
168169
}
169170
};
170171

172+
const void *const swift::_swift_concurrency_debug_asyncTaskMetadata =
173+
static_cast<Metadata *>(&taskHeapMetadata);
174+
171175
/// The function that we put in the context of a simple task
172176
/// to handle the final return.
173177
SWIFT_CC(swift)

0 commit comments

Comments
 (0)