Skip to content

Commit acb4142

Browse files
committed
[RemoteMirrors] Move the interop typedefs into a separate header for API clients that just want to pass the types around.
1 parent 6c59410 commit acb4142

File tree

2 files changed

+47
-18
lines changed

2 files changed

+47
-18
lines changed

include/swift/SwiftRemoteMirror/SwiftRemoteMirrorLegacyInterop.h

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,16 @@
2222

2323
#if defined(__APPLE__) && defined(__MACH__)
2424

25+
#include "SwiftRemoteMirrorLegacyInteropTypes.h"
2526
#include "SwiftRemoteMirror.h"
2627

2728
#include <dlfcn.h>
2829
#include <mach-o/getsect.h>
2930

30-
#define SWIFT_LEGACY_METADATA_MIN_VERSION 3
31-
32-
/// The remote representation of a Swift metada pointer as returned by
33-
/// interop wrappers.
34-
typedef struct swift_metadata_interop {
35-
uintptr_t Metadata;
36-
int Library;
37-
} swift_metadata_interop_t;
38-
39-
/// The remote representation of a Swift typeref as returned by interop
40-
/// wrappers.
41-
typedef struct swift_typeref_interop {
42-
swift_typeref_t Typeref;
43-
int Library;
44-
} swift_typeref_interop_t;
45-
4631
/// The "public" interface follows. All of these functions are the same
4732
/// as the corresponding swift_reflection_* functions, except for taking
4833
/// or returning _interop data types in some circumstances.
4934

50-
typedef struct SwiftReflectionInteropContext *SwiftReflectionInteropContextRef;
51-
5235
static inline SwiftReflectionInteropContextRef
5336
swift_reflection_interop_createReflectionContext(
5437
void *ReaderContext,
@@ -153,6 +136,9 @@ size_t swift_reflection_interop_demangle(SwiftReflectionInteropContextRef Contex
153136
/// \name Internal implementation details, clients don't need to use these.
154137
/// @{
155138

139+
/// The minimum supported metadata version for the legacy library.
140+
#define SWIFT_LEGACY_METADATA_MIN_VERSION 3
141+
156142
/// The legacy reflection info struct.
157143
typedef struct swift_reflection_legacy_info {
158144
swift_reflection_section_t fieldmd;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//===--- SwiftRemoteMirrorLegacyInteropTypes.h - Legacy lib interop types. ------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 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+
/// \file
14+
/// This header provides an interface for using multiple versions of the Swift remote
15+
/// mirror library to inspect processes built with different versions of Swift, or
16+
/// processes where different libraries are built with different versions of Swift.
17+
///
18+
//===----------------------------------------------------------------------------===//
19+
20+
#ifndef SWIFT_REMOTE_MIRROR_LEGACY_INTEROP_TYPES_H
21+
#define SWIFT_REMOTE_MIRROR_LEGACY_INTEROP_TYPES_H
22+
23+
#include "SwiftRemoteMirror.h"
24+
25+
/// The remote representation of a Swift metada pointer as returned by
26+
/// interop wrappers.
27+
typedef struct swift_metadata_interop {
28+
uintptr_t Metadata;
29+
int Library;
30+
} swift_metadata_interop_t;
31+
32+
/// The remote representation of a Swift typeref as returned by interop
33+
/// wrappers.
34+
typedef struct swift_typeref_interop {
35+
swift_typeref_t Typeref;
36+
int Library;
37+
} swift_typeref_interop_t;
38+
39+
/// An opaque reflection context object.
40+
typedef struct SwiftReflectionInteropContext *SwiftReflectionInteropContextRef;
41+
42+
#endif // SWIFT_REMOTE_MIRROR_LEGACY_INTEROP_TYPES_H
43+

0 commit comments

Comments
 (0)