Skip to content

Commit ef9d2b7

Browse files
authored
Rename pointer bounds (#78210)
* Make pointer bounds non-experimental * Rename @PointerBounds to @_SwiftifyImport * Rename filenames containing PointerBounds * Add _PointerParam exception to stdlib ABI test * Add _PointerParam to stdlib API changes * Rename _PointerParam to _SwiftifyInfo
1 parent 57cce71 commit ef9d2b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+94
-172
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,6 @@ option(SWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION
747747
"Enable experimental SwiftParser validation by default"
748748
FALSE)
749749

750-
option(SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS
751-
"Enable experimental safe wrappers around external functions"
752-
FALSE)
753-
754750
cmake_dependent_option(SWIFT_BUILD_SOURCEKIT
755751
"Build SourceKit" TRUE
756752
"SWIFT_ENABLE_DISPATCH" FALSE)
@@ -1397,7 +1393,6 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
13971393
message(STATUS "Observation Support: ${SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION}")
13981394
message(STATUS "Synchronization Support: ${SWIFT_ENABLE_SYNCHRONIZATION}")
13991395
message(STATUS "Volatile Support: ${SWIFT_ENABLE_VOLATILE}")
1400-
message(STATUS "Pointer Bounds Support: ${SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS}")
14011396
message(STATUS "")
14021397
else()
14031398
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")

Runtimes/Core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# Catalyst Support
2929
# -- Will need shadow invocations to generate swiftmodules for Swift parts
3030
# Install *.abi.json, swiftdoc, and swiftsourceinfo
31-
# Pointer bounds (SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS)
3231

3332
cmake_minimum_required(VERSION 3.26...3.29)
3433

include/swift/Option/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,6 @@ def enable_experimental_concise_pound_file : Flag<["-"],
792792
Flags<[FrontendOption, ModuleInterfaceOption]>,
793793
HelpText<"Enable experimental concise '#file' identifier">;
794794

795-
def enable_experimental_bounds_safety_interop :
796-
Flag<["-"], "enable-experimental-bounds-safety-interop">,
797-
Flags<[NoDriverOption, FrontendOption, HelpHidden, ModuleInterfaceOption]>,
798-
HelpText<"Enable experimental C bounds safety interop code generation and config directives">;
799-
800795
def enable_experimental_cxx_interop :
801796
Flag<["-"], "enable-experimental-cxx-interop">,
802797
Flags<[NoDriverOption, FrontendOption, HelpHidden]>,

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8673,16 +8673,16 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
86738673
}
86748674

86758675
namespace {
8676-
class PointerParamInfoPrinter {
8676+
class SwiftifyInfoPrinter {
86778677
public:
86788678
clang::ASTContext &ctx;
86798679
llvm::raw_ostream &out;
86808680
bool firstParam = true;
8681-
PointerParamInfoPrinter(clang::ASTContext &ctx, llvm::raw_ostream &out)
8681+
SwiftifyInfoPrinter(clang::ASTContext &ctx, llvm::raw_ostream &out)
86828682
: ctx(ctx), out(out) {
8683-
out << "@PointerBounds(";
8683+
out << "@_SwiftifyImport(";
86848684
}
8685-
~PointerParamInfoPrinter() { out << ")"; }
8685+
~SwiftifyInfoPrinter() { out << ")"; }
86868686

86878687
void printCountedBy(const clang::CountAttributedType *CAT,
86888688
size_t pointerIndex) {
@@ -8725,7 +8725,7 @@ void ClangImporter::Implementation::importBoundsAttributes(
87258725
{
87268726
llvm::raw_svector_ostream out(MacroString);
87278727

8728-
PointerParamInfoPrinter printer(getClangASTContext(), out);
8728+
SwiftifyInfoPrinter printer(getClangASTContext(), out);
87298729
for (auto [index, param] : llvm::enumerate(ClangDecl->parameters())) {
87308730
if (auto CAT = param->getType()->getAs<clang::CountAttributedType>()) {
87318731
printer.printCountedBy(CAT, index);

lib/Macros/Sources/SwiftMacros/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ add_swift_macro_library(SwiftMacros
1616
DistributedResolvableMacro.swift
1717
SyntaxExtensions.swift
1818
TaskLocalMacro.swift
19-
PointerBoundsMacro.swift
19+
SwiftifyImportMacro.swift
2020
SWIFT_DEPENDENCIES
2121
SwiftDiagnostics
2222
SwiftSyntax

lib/Macros/Sources/SwiftMacros/PointerBoundsMacro.swift renamed to lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ func getParameterIndexForDeclRef(
461461
/// Intended to map to C attributes like __counted_by, __ended_by and __no_escape,
462462
/// for automatic application by ClangImporter when the C declaration is annotated
463463
/// appropriately.
464-
public struct PointerBoundsMacro: PeerMacro {
464+
public struct SwiftifyImportMacro: PeerMacro {
465465
static func parseEnumName(_ enumConstructorExpr: FunctionCallExprSyntax) throws -> String {
466466
guard let calledExpr = enumConstructorExpr.calledExpression.as(MemberAccessExprSyntax.self)
467467
else {
468468
throw DiagnosticError(
469-
"expected PointerParam enum literal as argument, got '\(enumConstructorExpr)'",
469+
"expected _SwiftifyInfo enum literal as argument, got '\(enumConstructorExpr)'",
470470
node: enumConstructorExpr)
471471
}
472472
return calledExpr.declName.baseName.text
@@ -564,7 +564,7 @@ public struct PointerBoundsMacro: PeerMacro {
564564
let paramExpr = paramAST.expression
565565
guard let enumConstructorExpr = paramExpr.as(FunctionCallExprSyntax.self) else {
566566
throw DiagnosticError(
567-
"expected PointerParam enum literal as argument, got '\(paramExpr)'", node: paramExpr)
567+
"expected _SwiftifyInfo enum literal as argument, got '\(paramExpr)'", node: paramExpr)
568568
}
569569
let enumName = try parseEnumName(enumConstructorExpr)
570570
switch enumName {
@@ -627,7 +627,7 @@ public struct PointerBoundsMacro: PeerMacro {
627627
}
628628
if argByIndex[i] != nil {
629629
throw DiagnosticError(
630-
"multiple PointerParams referring to parameter with index "
630+
"multiple _SwiftifyInfos referring to parameter with index "
631631
+ "\(i): \(pointerArg) and \(argByIndex[i]!)", node: pointerArg.original)
632632
}
633633
argByIndex[i] = pointerArg
@@ -647,7 +647,7 @@ public struct PointerBoundsMacro: PeerMacro {
647647
) throws -> [DeclSyntax] {
648648
do {
649649
guard let funcDecl = declaration.as(FunctionDeclSyntax.self) else {
650-
throw DiagnosticError("@PointerBounds only works on functions", node: declaration)
650+
throw DiagnosticError("@_SwiftifyImport only works on functions", node: declaration)
651651
}
652652

653653
let argumentList = node.arguments!.as(LabeledExprListSyntax.self)!
@@ -692,7 +692,7 @@ public struct PointerBoundsMacro: PeerMacro {
692692
case .attribute(let attr):
693693
// don't apply this macro recursively, and avoid dupe _alwaysEmitIntoClient
694694
let name = attr.attributeName.as(IdentifierTypeSyntax.self)?.name.text
695-
return name == nil || (name != "PointerBounds" && name != "_alwaysEmitIntoClient")
695+
return name == nil || (name != "_SwiftifyImport" && name != "_alwaysEmitIntoClient")
696696
default: return true
697697
}
698698
} + [

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,6 @@ function(_add_target_variant_swift_compile_flags
326326
list(APPEND result "-D" "SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION")
327327
endif()
328328

329-
if(SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS)
330-
list(APPEND result "-D" "SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS")
331-
endif()
332-
333329
if(SWIFT_ENABLE_SYNCHRONIZATION)
334330
list(APPEND result "-D" "SWIFT_ENABLE_SYNCHRONIZATION")
335331
endif()

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ split_embedded_sources(
230230
EMBEDDED Int128.swift
231231
EMBEDDED Mirror.swift
232232
NORMAL PlaygroundDisplay.swift
233+
EMBEDDED SwiftifyImport.swift
233234
NORMAL CommandLine.swift
234235
EMBEDDED SliceBuffer.swift
235236
EMBEDDED StaticBigInt.swift
@@ -263,11 +264,6 @@ if(SWIFT_STDLIB_ENABLE_VECTOR_TYPES)
263264
list(APPEND SWIFTLIB_EMBEDDED_GYB_SOURCES SIMDConcreteOperations.swift.gyb SIMDVectorTypes.swift.gyb)
264265
endif()
265266

266-
if (SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS)
267-
list(APPEND SWIFTLIB_SOURCES PointerBounds.swift)
268-
list(APPEND SWIFTLIB_EMBEDDED_SOURCES PointerBounds.swift)
269-
endif()
270-
271267
# Freestanding and Linux/Android builds both have failures to resolve.
272268
if(NOT BOOTSTRAPPING_MODE STREQUAL "OFF" AND NOT SWIFT_FREESTANDING_FLAVOR AND NOT SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX" AND NOT SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
273269
list(APPEND SWIFTLIB_SOURCES ObjectIdentifier+DebugDescription.swift)

stdlib/public/core/GroupInfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
],
191191
"Pointer": [
192192
"Pointer.swift",
193-
"PointerBounds.swift",
193+
"SwiftifyImport.swift",
194194
"TemporaryAllocation.swift",
195195
"UnsafePointer.swift",
196196
"UnsafeRawPointer.swift",

stdlib/public/core/PointerBounds.swift renamed to stdlib/public/core/SwiftifyImport.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
/// Different ways to annotate pointer parameters using the `@PointerBounds` macro.
1+
/// Different ways to annotate pointer parameters using the `@_SwiftifyImport` macro.
22
/// All indices into parameter lists start at 1. Indices __must__ be integer literals, and strings
3-
/// __must__ be string literals, because their contents are parsed by the `@PointerBounds` macro.
3+
/// __must__ be string literals, because their contents are parsed by the `@_SwiftifyImport` macro.
44
/// Only 1 instance of `countedBy`, `sizedBy` or `endedBy` can refer to each pointer index, however
55
/// `nonescaping` is orthogonal to the rest and can (and should) overlap with other annotations.
6-
public enum PointerParam {
6+
///
7+
/// This is not marked @available, because _SwiftifyImport is available for any target. Instances
8+
/// of _SwiftifyInfo should ONLY be passed as arguments directly to _SwiftifyImport, so they should
9+
/// not affect linkage since there are never any instances at runtime.
10+
public enum _SwiftifyInfo {
711
/// Corresponds to the C `__counted_by(count)` attribute.
812
/// Parameter pointer: index of pointer in function parameter list. Must be of type
913
/// `Unsafe[Mutable]Pointer<T>[?]`, i.e. not an `UnsafeRawPointer`.
@@ -40,5 +44,5 @@ public enum PointerParam {
4044
/// Parameter paramInfo: information about how the function uses the pointer passed to it. The
4145
/// safety of the generated wrapper function depends on this info being extensive and accurate.
4246
@attached(peer, names: overloaded)
43-
public macro PointerBounds(_ paramInfo: PointerParam...) =
44-
#externalMacro(module: "SwiftMacros", type: "PointerBoundsMacro")
47+
public macro _SwiftifyImport(_ paramInfo: _SwiftifyInfo...) =
48+
#externalMacro(module: "SwiftMacros", type: "SwiftifyImportMacro")

test/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,6 @@ foreach(SDK ${SWIFT_SDKS})
457457
list(APPEND LIT_ARGS "--param" "string_processing")
458458
endif()
459459

460-
if(SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS)
461-
list(APPEND LIT_ARGS "--param" "pointer_bounds")
462-
endif()
463-
464460
if(SWIFT_ENABLE_BACKTRACING)
465461
list(APPEND LIT_ARGS "--param" "backtracing")
466462
endif()

test/Interop/C/pointer-bounds/Inputs/counted-by.h renamed to test/Interop/C/swiftify-import/Inputs/counted-by.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
void simple(int len, int * __counted_by(len) p);
66

7-
void swiftAttr(int len, int * p) __attribute__((swift_attr("@PointerBounds(.countedBy(pointer: 2, count: \"len\"))")));
7+
void swiftAttr(int len, int *p) __attribute__((
8+
swift_attr("@_SwiftifyImport(.countedBy(pointer: 2, count: \"len\"))")));
89

910
void shared(int len, int * __counted_by(len) p1, int * __counted_by(len) p2);
1011

test/Interop/C/pointer-bounds/counted-by.swift renamed to test/Interop/C/swiftify-import/counted-by.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// REQUIRES: swift_feature_SafeInteropWrappers
2-
// REQUIRES: pointer_bounds
32

43
// RUN: %empty-directory(%t)
54
// RUN: %target-swift-frontend -emit-module -disable-availability-checking -plugin-path %swift-plugin-dir -o %t/CountedBy.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers %s
65

7-
// Check that ClangImporter correctly infers and expands @PointerBounds macros for functions with __counted_by parameters.
6+
// Check that ClangImporter correctly infers and expands @_SwiftifyImport macros for functions with __counted_by parameters.
87

98
import CountedByClang
109

test/Macros/PointerBounds/MacroErrors/SamePointer.swift

Lines changed: 0 additions & 9 deletions
This file was deleted.

test/Macros/PointerBounds/CountedBy/CountExpr.swift renamed to test/Macros/SwiftifyImport/CountedBy/CountExpr.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "size * count"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "size * count"))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ size: CInt, _ count: CInt) {
87
}
98

test/Macros/PointerBounds/CountedBy/MultipleParams.swift renamed to test/Macros/SwiftifyImport/CountedBy/MultipleParams.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"), .countedBy(pointer: 3, count: "len2"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"), .countedBy(pointer: 3, count: "len2"))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt, _ ptr2: UnsafePointer<CInt>, _ len2: CInt) {
87
}
98

test/Macros/PointerBounds/CountedBy/Mutable.swift renamed to test/Macros/SwiftifyImport/CountedBy/Mutable.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
func myFunc(_ ptr: UnsafeMutablePointer<CInt>, _ len: CInt) {
87
}
98

test/Macros/PointerBounds/CountedBy/MutableSpan.swift renamed to test/Macros/SwiftifyImport/CountedBy/MutableSpan.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32
// REQUIRES: swift_feature_Span
43

54
// RUN: not %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -enable-experimental-feature Span > %t.log 2>&1
65
// RUN: %FileCheck --match-full-lines %s < %t.log
76

8-
@PointerBounds(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
7+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
98
func myFunc(_ ptr: UnsafeMutablePointer<CInt>, _ len: CInt) {
109
}
1110

test/Macros/PointerBounds/CountedBy/Nullable.swift renamed to test/Macros/SwiftifyImport/CountedBy/Nullable.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
func myFunc(_ ptr: UnsafePointer<CInt>?, _ len: CInt) {
87
}
98

test/Macros/PointerBounds/CountedBy/QualifiedTypes.swift renamed to test/Macros/SwiftifyImport/CountedBy/QualifiedTypes.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
func foo(_ ptr: Swift.UnsafePointer<Swift.Int>, _ len: Swift.Int) -> Swift.Void {
87
}
98

10-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
9+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
1110
func bar(_ ptr: Swift.UnsafePointer<Swift.CInt>, _ len: Swift.Int) -> () {
1211
}
1312

test/Macros/PointerBounds/CountedBy/Return.swift renamed to test/Macros/SwiftifyImport/CountedBy/Return.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) -> CInt {
87
}
98

test/Macros/PointerBounds/CountedBy/SharedCount.swift renamed to test/Macros/SwiftifyImport/CountedBy/SharedCount.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"), .countedBy(pointer: 2, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"), .countedBy(pointer: 2, count: "len"))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ ptr2: UnsafePointer<CInt>, _ len: CInt) {
87
}
98

test/Macros/PointerBounds/CountedBy/SimpleCount.swift renamed to test/Macros/SwiftifyImport/CountedBy/SimpleCount.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) {
87
}
98

test/Macros/PointerBounds/CountedBy/SimpleSpan.swift renamed to test/Macros/SwiftifyImport/CountedBy/SimpleSpan.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32
// REQUIRES: swift_feature_Span
43

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

7-
@PointerBounds(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
6+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
87
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) {
98
}
109

test/Macros/PointerBounds/CountedBy/SimpleSpanWithReturn.swift renamed to test/Macros/SwiftifyImport/CountedBy/SimpleSpanWithReturn.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32
// REQUIRES: swift_feature_Span
43

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

7-
@PointerBounds(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
6+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"), .nonescaping(pointer: 1))
87
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) -> CInt {
98
}
109

test/Macros/PointerBounds/CountedBy/Unwrapped.swift renamed to test/Macros/SwiftifyImport/CountedBy/Unwrapped.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// 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
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
func myFunc(_ ptr: UnsafePointer<CInt>!, _ len: CInt) {
87
}
98

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// REQUIRES: swift_swift_parser
2-
// REQUIRES: pointer_bounds
32

43
// RUN: %target-typecheck-verify-swift %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
54

6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
76
// expected-error@+1{{expected pointer type, got [CInt] with kind arrayType}}
87
func myFunc(_ ptr: [CInt], _ len: String) {
98
}

0 commit comments

Comments
 (0)