Skip to content

Add @PointerBounds macro #76969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion test/Macros/PointerBounds/CountedBy/MutableSpan.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// REQUIRES: swift_swift_parser
// REQUIRES: pointer_bounds

// XFAIL: OS=windows-msvc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DougGregor if MutableSpan is unavailable, shouldn't we XFAIL this on all platforms?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that the macro is being expanded but nothing ever type-checks it, so it's "working" for now but will fail with subsequent changes. We can disable then.

// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s

@PointerBounds(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
Expand Down
2 changes: 1 addition & 1 deletion test/Macros/PointerBounds/SizedBy/MutableRawSpan.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// REQUIRES: swift_swift_parser
// REQUIRES: pointer_bounds

// XFAIL: OS=windows-msvc
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s

@PointerBounds(.sizedBy(pointer: 1, size: "size"), .nonescaping(pointer: 1))
Expand Down