Skip to content

Commit 072066b

Browse files
committed
Rename @PointerBounds to @_SwiftifyImport
1 parent ebad9ea commit 072066b

38 files changed

+56
-55
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8631,7 +8631,7 @@ class PointerParamInfoPrinter {
86318631
bool firstParam = true;
86328632
PointerParamInfoPrinter(clang::ASTContext &ctx, llvm::raw_ostream &out)
86338633
: ctx(ctx), out(out) {
8634-
out << "@PointerBounds(";
8634+
out << "@_SwiftifyImport(";
86358635
}
86368636
~PointerParamInfoPrinter() { out << ")"; }
86378637

lib/Macros/Sources/SwiftMacros/PointerBoundsMacro.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 _PointerParam 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 _PointerParam 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 _PointerParams 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/public/core/PointerBounds.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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+
public enum _PointerParam {
77
/// Corresponds to the C `__counted_by(count)` attribute.
88
/// Parameter pointer: index of pointer in function parameter list. Must be of type
99
/// `Unsafe[Mutable]Pointer<T>[?]`, i.e. not an `UnsafeRawPointer`.
@@ -40,5 +40,5 @@ public enum PointerParam {
4040
/// Parameter paramInfo: information about how the function uses the pointer passed to it. The
4141
/// safety of the generated wrapper function depends on this info being extensive and accurate.
4242
@attached(peer, names: overloaded)
43-
public macro PointerBounds(_ paramInfo: PointerParam...) =
44-
#externalMacro(module: "SwiftMacros", type: "PointerBoundsMacro")
43+
public macro _SwiftifyImport(_ paramInfo: _PointerParam...) =
44+
#externalMacro(module: "SwiftMacros", type: "SwiftifyImportMacro")

test/Interop/C/pointer-bounds/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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %empty-directory(%t)
44
// 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
55

6-
// 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.
77

88
import CountedByClang
99

test/Macros/PointerBounds/CountedBy/CountExpr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

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

test/Macros/PointerBounds/CountedBy/MultipleParams.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

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

test/Macros/PointerBounds/CountedBy/Mutable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
66
func myFunc(_ ptr: UnsafeMutablePointer<CInt>, _ len: CInt) {
77
}
88

test/Macros/PointerBounds/CountedBy/MutableSpan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// 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
55
// RUN: %FileCheck --match-full-lines %s < %t.log
66

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

test/Macros/PointerBounds/CountedBy/Nullable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

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

test/Macros/PointerBounds/CountedBy/QualifiedTypes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
// 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
44

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

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

test/Macros/PointerBounds/CountedBy/Return.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
66
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) -> CInt {
77
}
88

test/Macros/PointerBounds/CountedBy/SharedCount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

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

test/Macros/PointerBounds/CountedBy/SimpleCount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
5+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
66
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) {
77
}
88

test/Macros/PointerBounds/CountedBy/SimpleSpan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// 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
55

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

test/Macros/PointerBounds/CountedBy/SimpleSpanWithReturn.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// 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
55

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

test/Macros/PointerBounds/CountedBy/Unwrapped.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

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

test/Macros/PointerBounds/MacroErrors/ArrayType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

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

test/Macros/PointerBounds/MacroErrors/DynamicCountExpr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
let countString = "len"
66
// expected-error@+1{{expected string literal for 'count' parameter, got countString}}
7-
@PointerBounds(.countedBy(pointer: 1, count: countString))
7+
@_SwiftifyImport(.countedBy(pointer: 1, count: countString))
88
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
99
}

test/Macros/PointerBounds/MacroErrors/DynamicEnum.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

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

5-
let countedBy = PointerParam.countedBy(pointer: 1, count: "len")
6-
// expected-error@+1{{expected PointerParam enum literal as argument, got 'countedBy'}}
7-
@PointerBounds(countedBy)
5+
let countedBy = _PointerParam.countedBy(pointer: 1, count: "len")
6+
// expected-error@+1{{expected _PointerParam enum literal as argument, got 'countedBy'}}
7+
@_SwiftifyImport(countedBy)
88
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
99
}

test/Macros/PointerBounds/MacroErrors/DynamicPointerIndex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
let pointerIndex = 1
66
// expected-error@+1{{expected integer literal, got 'pointerIndex'}}
7-
@PointerBounds(.countedBy(pointer: pointerIndex, count: "len"))
7+
@_SwiftifyImport(.countedBy(pointer: pointerIndex, count: "len"))
88
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
99
}

test/Macros/PointerBounds/MacroErrors/InvalidCount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
// RUN: %target-typecheck-verify-swift %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
44

55
// expected-error@+1{{no parameter with name 'foo' in '_ ptr: UnsafePointer<CInt>, _ len: CInt'}}
6-
@PointerBounds(.countedBy(pointer: 1, count: "foo"))
6+
@_SwiftifyImport(.countedBy(pointer: 1, count: "foo"))
77
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) {
88
}

test/Macros/PointerBounds/MacroErrors/PointerIndexOutOfBounds.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
// RUN: %target-typecheck-verify-swift %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
44

55
// expected-error@+1{{pointer index out of bounds}}
6-
@PointerBounds(.countedBy(pointer: 3, count: "len"))
6+
@_SwiftifyImport(.countedBy(pointer: 3, count: "len"))
77
// expected-note@+1{{function myFunc has parameter indices 1..2}}
88
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt) {
99
}
1010
// expected-error@+1{{pointer index out of bounds}}
11-
@PointerBounds(.countedBy(pointer: 0, count: "len"))
11+
@_SwiftifyImport(.countedBy(pointer: 0, count: "len"))
1212
// expected-note@+1{{function myFunc2 has parameter indices 1..2}}
1313
func myFunc2(_ ptr: UnsafePointer<CInt>, _ len: CInt) {
1414
}
1515
// expected-error@+1{{pointer index out of bounds}}
16-
@PointerBounds(.countedBy(pointer: 0, count: "1"))
16+
@_SwiftifyImport(.countedBy(pointer: 0, count: "1"))
1717
// expected-note@+1{{function myFunc3 has no parameters}}
1818
func myFunc3() {
1919
}

test/Macros/PointerBounds/MacroErrors/SamePointer.swift

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

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

5-
// expected-error@+1{{multiple PointerParams referring to parameter with index 1: .countedBy(pointer: 1, count: "dummy", nonescaping: false) and .countedBy(pointer: 1, count: "len", nonescaping: false)}}
6-
@PointerBounds(.countedBy(pointer: 1, count: "len"), .countedBy(pointer: 1, count: "dummy"))
5+
// expected-error@+1{{multiple _PointerParams referring to parameter with index 1: .countedBy(pointer: 1, count: "dummy", nonescaping: false) and .countedBy(pointer: 1, count: "len", nonescaping: false)}}
6+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"), .countedBy(pointer: 1, count: "dummy"))
77
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: CInt, _ dummy: CInt) {
88
}

test/Macros/PointerBounds/MacroErrors/UnexpectedCountExpr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
// RUN: %target-typecheck-verify-swift %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
44

55
// expected-error@+1{{cannot convert value of type 'Int' to expected argument type 'String'}}
6-
@PointerBounds(.countedBy(pointer: 1, count: 2))
6+
@_SwiftifyImport(.countedBy(pointer: 1, count: 2))
77
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
88
}

test/Macros/PointerBounds/MacroErrors/UnexpectedCountType.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// RUN: not %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
66
// RUN: %target-typecheck-verify-swift %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
77

8-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
8+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
99
func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
1010
}
1111

@@ -14,4 +14,4 @@ func myFunc(_ ptr: UnsafePointer<CInt>, _ len: String) {
1414
// CHECK-NEXT: myFunc(ptr.baseAddress!, String(exactly: ptr.count)!)
1515
// CHECK-NEXT: }
1616

17-
// expected-error@PointerBounds:2{{no exact matches in call to initializer}}
17+
// expected-error@_SwiftifyImport:2{{no exact matches in call to initializer}}

test/Macros/PointerBounds/MacroErrors/UnexpectedPointerType.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// RUN: %target-typecheck-verify-swift -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
44

55
// expected-error@+2{{expected Unsafe[Mutable][Raw]Pointer type for type CInt - first type token is 'CInt'}}
6-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
6+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
77
func myFunc(_ ptr: CInt, _ len: CInt) {
88
}
99
// expected-error@+2{{expected Unsafe[Mutable][Raw]Pointer type for type UnsafeBufferPointer<CInt> - first type token is 'UnsafeBufferPointer'}}
10-
@PointerBounds(.countedBy(pointer: 1, count: "len"))
10+
@_SwiftifyImport(.countedBy(pointer: 1, count: "len"))
1111
func myFunc2(_ ptr: UnsafeBufferPointer<CInt>, _ len: CInt) {
1212
}

test/Macros/PointerBounds/SizedBy/MultipleParams.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.sizedBy(pointer: 1, size: "size"), .sizedBy(pointer: 3, size: "size2"))
5+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"), .sizedBy(pointer: 3, size: "size2"))
66
func myFunc(_ ptr: UnsafeRawPointer, _ size: CInt, _ ptr2: UnsafeRawPointer, _ size2: CInt) {
77
}
88

test/Macros/PointerBounds/SizedBy/Mutable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.sizedBy(pointer: 1, size: "size"))
5+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"))
66
func myFunc(_ ptr: UnsafeMutableRawPointer, _ size: CInt) {
77
}
88

test/Macros/PointerBounds/SizedBy/MutableRawSpan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// 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
55
// RUN: %FileCheck --match-full-lines %s < %t.log
66

7-
@PointerBounds(.sizedBy(pointer: 1, size: "size"), .nonescaping(pointer: 1))
7+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"), .nonescaping(pointer: 1))
88
func myFunc(_ ptr: UnsafeMutableRawPointer, _ size: CInt) {
99
}
1010

test/Macros/PointerBounds/SizedBy/Nullable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.sizedBy(pointer: 1, size: "size"))
5+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"))
66
func myFunc(_ ptr: UnsafeRawPointer?, _ size: CInt) {
77
}
88

test/Macros/PointerBounds/SizedBy/Return.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.sizedBy(pointer: 1, size: "size"))
5+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"))
66
func myFunc(_ ptr: UnsafeRawPointer, _ size: CInt) -> CInt {
77
}
88

test/Macros/PointerBounds/SizedBy/SharedCount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// 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
44

5-
@PointerBounds(.sizedBy(pointer: 1, size: "size"), .sizedBy(pointer: 2, size: "size"))
5+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"), .sizedBy(pointer: 2, size: "size"))
66
func myFunc(_ ptr: UnsafeRawPointer, _ ptr2: UnsafeRawPointer, _ size: CInt) {
77
}
88

test/Macros/PointerBounds/SizedBy/SimpleRawSpan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// 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
55

6-
@PointerBounds(.sizedBy(pointer: 1, size: "size"), .nonescaping(pointer: 1))
6+
@_SwiftifyImport(.sizedBy(pointer: 1, size: "size"), .nonescaping(pointer: 1))
77
func myFunc(_ ptr: UnsafeRawPointer, _ size: CInt) {
88
}
99

0 commit comments

Comments
 (0)