Skip to content

Commit 75309ed

Browse files
authored
Add Heap and HashTable (#161)
1 parent 9792105 commit 75309ed

File tree

17 files changed

+1479
-28
lines changed

17 files changed

+1479
-28
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ if libraryEvolutionCondition {
135135

136136
// MARK: - Targets
137137

138-
let openGraphTarget = Target.target(
138+
let openAttributeGraphTarget = Target.target(
139139
name: "OpenAttributeGraph",
140140
dependencies: ["OpenAttributeGraphCxx"],
141141
cSettings: sharedCSettings,
@@ -144,7 +144,7 @@ let openGraphTarget = Target.target(
144144
// FIXME: Merge into one target
145145
// OpenAttributeGraph is a C++ & Swift mix target.
146146
// The SwiftPM support for such usage is still in progress.
147-
let openGraphSPITarget = Target.target(
147+
let openAttributeGraphSPITarget = Target.target(
148148
name: "OpenAttributeGraphCxx",
149149
cSettings: sharedCSettings + [
150150
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
@@ -153,15 +153,15 @@ let openGraphSPITarget = Target.target(
153153
.linkedLibrary("z"),
154154
]
155155
)
156-
let openGraphShimsTarget = Target.target(
156+
let openAttributeGraphShimsTarget = Target.target(
157157
name: "OpenAttributeGraphShims",
158158
cSettings: sharedCSettings,
159159
swiftSettings: sharedSwiftSettings
160160
)
161161

162162
// MARK: - Test Targets
163163

164-
let openGraphTestsTarget = Target.testTarget(
164+
let openAttributeGraphTestsTarget = Target.testTarget(
165165
name: "OpenAttributeGraphTests",
166166
dependencies: [
167167
"OpenAttributeGraph",
@@ -170,15 +170,16 @@ let openGraphTestsTarget = Target.testTarget(
170170
cSettings: sharedCSettings,
171171
swiftSettings: sharedSwiftSettings
172172
)
173-
let openGraphCxxTestsTarget = Target.testTarget(
173+
let openAttributeGraphCxxTestsTarget = Target.testTarget(
174174
name: "OpenAttributeGraphCxxTests",
175175
dependencies: [
176176
"OpenAttributeGraphCxx",
177177
],
178178
exclude: ["README.md"],
179+
cSettings: sharedCSettings + [.define("SWIFT_TESTING")],
179180
swiftSettings: sharedSwiftSettings + [.interoperabilityMode(.Cxx)]
180181
)
181-
let openGraphShimsTestsTarget = Target.testTarget(
182+
let openAttributeGraphShimsTestsTarget = Target.testTarget(
182183
name: "OpenAttributeGraphShimsTests",
183184
dependencies: [
184185
"OpenAttributeGraphShims",
@@ -187,7 +188,7 @@ let openGraphShimsTestsTarget = Target.testTarget(
187188
cSettings: sharedCSettings,
188189
swiftSettings: sharedSwiftSettings
189190
)
190-
let openGraphCompatibilityTestsTarget = Target.testTarget(
191+
let openAttributeGraphCompatibilityTestsTarget = Target.testTarget(
191192
name: "OpenAttributeGraphCompatibilityTests",
192193
dependencies: [
193194
.product(name: "Numerics", package: "swift-numerics"),
@@ -209,14 +210,14 @@ let package = Package(
209210
.package(url: "https://github.com/apple/swift-numerics", from: "1.0.2"),
210211
],
211212
targets: [
212-
openGraphTarget,
213-
openGraphSPITarget,
214-
openGraphShimsTarget,
215-
216-
openGraphTestsTarget,
217-
openGraphCxxTestsTarget,
218-
openGraphShimsTestsTarget,
219-
openGraphCompatibilityTestsTarget,
213+
openAttributeGraphTarget,
214+
openAttributeGraphSPITarget,
215+
openAttributeGraphShimsTarget,
216+
217+
openAttributeGraphTestsTarget,
218+
openAttributeGraphCxxTestsTarget,
219+
openAttributeGraphShimsTestsTarget,
220+
openAttributeGraphCompatibilityTestsTarget,
220221
],
221222
cxxLanguageStandard: .cxx20
222223
)
@@ -253,7 +254,7 @@ if attributeGraphCondition {
253254
privateFrameworkRepo = Package.Dependency.package(url: "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git", branch: "main")
254255
}
255256
package.dependencies.append(privateFrameworkRepo)
256-
openGraphShimsTarget.addAGSettings()
257+
openAttributeGraphShimsTarget.addAGSettings()
257258

258259
let agVersion = Context.environment["DARWIN_PRIVATE_FRAMEWORKS_TARGET_RELEASE"].flatMap { Int($0) } ?? 2024
259260
package.platforms = switch agVersion {
@@ -262,15 +263,15 @@ if attributeGraphCondition {
262263
default: nil
263264
}
264265
} else {
265-
openGraphShimsTarget.dependencies.append("OpenAttributeGraph")
266+
openAttributeGraphShimsTarget.dependencies.append("OpenAttributeGraph")
266267
package.platforms = [.iOS(.v13), .macOS(.v10_15), .macCatalyst(.v13), .tvOS(.v13), .watchOS(.v5)]
267268
}
268269

269270
let compatibilityTestCondition = envEnable("OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST")
270271
if compatibilityTestCondition && attributeGraphCondition {
271-
openGraphCompatibilityTestsTarget.addCompatibilitySettings()
272+
openAttributeGraphCompatibilityTestsTarget.addCompatibilitySettings()
272273
} else {
273-
openGraphCompatibilityTestsTarget.dependencies.append("OpenAttributeGraph")
274+
openAttributeGraphCompatibilityTestsTarget.dependencies.append("OpenAttributeGraph")
274275
}
275276

276277
extension [Platform] {

Scripts/bump_ag_pr.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ while [[ $# -gt 0 ]]; do
6464
done
6565

6666
SCRIPT_ROOT="$(dirname $(dirname $(filepath $0)))"
67-
OAG_REPO_DIR="$SCRIPT_ROOT/.og_repo"
67+
OAG_REPO_DIR="$SCRIPT_ROOT/.oag_repo"
6868
OPENATTRIBUTEGRAPH_ROOT="$OAG_REPO_DIR"
6969
AG_REPO_DIR="$SCRIPT_ROOT/.ag_repo"
7070

@@ -184,4 +184,4 @@ gh pr create \
184184
--base main
185185

186186
echo "✅ PR created successfully!"
187-
echo "Branch: update-ag-$TARGET_BRANCH"
187+
echo "Branch: update-ag-$TARGET_BRANCH"

Sources/OpenAttributeGraphCxx/DebugServer/DebugServer.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
OAG_EXTERN_C_BEGIN
3232
// DYLD_INTERPOSE does not work. Directly use the hook one here to match the semantics.
33-
bool og_variant_has_internal_diagnostics(const char *subsystem);
33+
bool oag_variant_has_internal_diagnostics(const char *subsystem);
3434
OAG_EXTERN_C_END
3535

3636
// MARK: DebugServer public API Implementation
@@ -265,7 +265,7 @@
265265
if (
266266
(mode & OAGDebugServerModeValid)
267267
&& !OAG::DebugServer::has_shared_server()
268-
&& og_variant_has_internal_diagnostics("org.OpenSwiftUIProject.OpenAttributeGraph")
268+
&& oag_variant_has_internal_diagnostics("org.OpenSwiftUIProject.OpenAttributeGraph")
269269
) {
270270
_shared_server = new DebugServer(mode);
271271
}

Sources/OpenAttributeGraphCxx/DebugServer/interpose.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
extern bool os_variant_has_internal_diagnostics(const char *subsystem);
1212
#endif
1313

14-
bool og_variant_has_internal_diagnostics(const char *subsystem) {
14+
bool oag_variant_has_internal_diagnostics(const char *subsystem) {
1515
if (strcmp(subsystem, "org.OpenSwiftUIProject.OpenAttributeGraph") == 0) {
1616
return true;
1717
} else if (strcmp(subsystem, "com.apple.AttributeGraph") == 0) {
@@ -30,5 +30,5 @@ bool og_variant_has_internal_diagnostics(const char *subsystem) {
3030
__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
3131
__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
3232

33-
DYLD_INTERPOSE(og_variant_has_internal_diagnostics, os_variant_has_internal_diagnostics)
33+
DYLD_INTERPOSE(oag_variant_has_internal_diagnostics, os_variant_has_internal_diagnostics)
3434
#endif

0 commit comments

Comments
 (0)