Skip to content

Commit 28af695

Browse files
committed
Include source ranges for decls in the AST dump.
1 parent dc5827c commit 28af695

14 files changed

+80
-73
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,13 @@ namespace {
574574
if (D->isImplicit())
575575
PrintWithColorRAII(OS, DeclModifierColor) << " implicit";
576576

577+
auto R = D->getSourceRange();
578+
if (R.isValid()) {
579+
PrintWithColorRAII(OS, RangeColor) << " range=";
580+
R.print(PrintWithColorRAII(OS, RangeColor).getOS(),
581+
D->getASTContext().SourceMgr, /*PrintText=*/false);
582+
}
583+
577584
if (D->TrailingSemiLoc.isValid())
578585
PrintWithColorRAII(OS, DeclModifierColor) << " trailing_semi";
579586
}

test/Driver/dump-parse.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: not %target-swift-frontend -dump-parse %s 2>&1 | %FileCheck %s
22
// RUN: not %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s -check-prefix=CHECK-AST
33

4-
// CHECK-LABEL: (func_decl "foo(_:)"
5-
// CHECK-AST-LABEL: (func_decl "foo(_:)"
4+
// CHECK-LABEL: (func_decl{{.*}}"foo(_:)"
5+
// CHECK-AST-LABEL: (func_decl{{.*}}"foo(_:)"
66
func foo(_ n: Int) -> Int {
77
// CHECK: (brace_stmt
88
// CHECK: (return_stmt
@@ -15,8 +15,8 @@ func foo(_ n: Int) -> Int {
1515
}
1616

1717
// -dump-parse should print an AST even though this code is invalid.
18-
// CHECK-LABEL: (func_decl "bar()"
19-
// CHECK-AST-LABEL: (func_decl "bar()"
18+
// CHECK-LABEL: (func_decl{{.*}}"bar()"
19+
// CHECK-AST-LABEL: (func_decl{{.*}}"bar()"
2020
func bar() {
2121
// CHECK: (brace_stmt
2222
// CHECK-NEXT: (unresolved_decl_ref_expr type='{{[^']+}}' name=foo
@@ -29,22 +29,22 @@ func bar() {
2929
foo foo foo
3030
}
3131

32-
// CHECK-LABEL: (enum_decl trailing_semi "TrailingSemi"
32+
// CHECK-LABEL: (enum_decl{{.*}}trailing_semi "TrailingSemi"
3333
enum TrailingSemi {
3434

35-
// CHECK-LABEL: (enum_case_decl trailing_semi
35+
// CHECK-LABEL: (enum_case_decl{{.*}}trailing_semi
3636
// CHECK-NOT: (enum_element_decl{{.*}}trailing_semi
37-
// CHECK: (enum_element_decl "A")
38-
// CHECK: (enum_element_decl "B")
37+
// CHECK: (enum_element_decl{{.*}}"A")
38+
// CHECK: (enum_element_decl{{.*}}"B")
3939
case A,B;
4040

41-
// CHECK-LABEL: (subscript_decl trailing_semi
42-
// CHECK-NOT: (func_decl trailing_semi 'anonname={{.*}}' getter_for=subscript(_:)
43-
// CHECK: (accessor_decl 'anonname={{.*}}' getter_for=subscript(_:)
41+
// CHECK-LABEL: (subscript_decl{{.*}}trailing_semi
42+
// CHECK-NOT: (func_decl{{.*}}trailing_semi 'anonname={{.*}}' getter_for=subscript(_:)
43+
// CHECK: (accessor_decl{{.*}}'anonname={{.*}}' getter_for=subscript(_:)
4444
subscript(x: Int) -> Int {
45-
// CHECK-LABEL: (pattern_binding_decl trailing_semi
46-
// CHECK-NOT: (var_decl trailing_semi "y"
47-
// CHECK: (var_decl "y"
45+
// CHECK-LABEL: (pattern_binding_decl{{.*}}trailing_semi
46+
// CHECK-NOT: (var_decl{{.*}}trailing_semi "y"
47+
// CHECK: (var_decl{{.*}}"y"
4848
var y = 1;
4949

5050
// CHECK-LABEL: (sequence_expr {{.*}} trailing_semi

test/NameBinding/import-resolution-overload.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extension HasFooSub {
5555
var foo: Int { return 0 }
5656
}
5757

58-
// CHECK-LABEL: func_decl "testHasFooSub(_:)"
58+
// CHECK-LABEL: func_decl{{.*}}"testHasFooSub(_:)"
5959
func testHasFooSub(_ hfs: HasFooSub) -> Int {
6060
// CHECK: return_stmt
6161
// CHECK-NOT: func_decl
@@ -67,7 +67,7 @@ extension HasBar {
6767
var bar: Int { return 0 }
6868
}
6969

70-
// CHECK-LABEL: func_decl "testHasBar(_:)"
70+
// CHECK-LABEL: func_decl{{.*}}"testHasBar(_:)"
7171
func testHasBar(_ hb: HasBar) -> Int {
7272
// CHECK: return_stmt
7373
// CHECK-NOT: func_decl

test/Parse/if_expr.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
22

3-
// CHECK: (func_decl "r13756261(_:_:)"
3+
// CHECK: (func_decl{{.*}}"r13756261(_:_:)"
44
func r13756261(_ x: Bool, _ y: Int) -> Int {
55
// CHECK: (if_expr
66
// CHECK: (call_expr
@@ -15,7 +15,7 @@ func r13756261(_ x: Bool, _ y: Int) -> Int {
1515
return (x) ? y : (x) ? y : (x) ? y : y
1616
}
1717

18-
// CHECK: (func_decl "r13756221(_:_:)"
18+
// CHECK: (func_decl{{.*}}"r13756221(_:_:)"
1919
func r13756221(_ x: Bool, _ y: Int) -> Int {
2020
// CHECK: (if_expr
2121
// CHECK: (call_expr
@@ -33,7 +33,7 @@ func r13756221(_ x: Bool, _ y: Int) -> Int {
3333
: y
3434
}
3535

36-
// CHECK: (func_decl "telescoping_if(_:_:)"
36+
// CHECK: (func_decl{{.*}}"telescoping_if(_:_:)"
3737
func telescoping_if(_ x: Bool, _ y: Int) -> Int {
3838
// CHECK: (if_expr
3939
// CHECK: (call_expr
@@ -69,7 +69,7 @@ func +>> (x: Bool, y: Bool) -> Bool {}
6969
func +<< (x: Bool, y: Bool) -> Bool {}
7070
func +== (x: Bool, y: Bool) -> Bool {}
7171

72-
// CHECK: (func_decl "prec_above(_:_:_:)"
72+
// CHECK: (func_decl{{.*}}"prec_above(_:_:_:)"
7373
func prec_above(_ x: Bool, _ y: Bool, _ z: Bool) -> Bool {
7474
// (x +>> y) ? (y +>> z) : ((x +>> y) ? (y +>> z) : (x +>> y))
7575
// CHECK: (if_expr
@@ -82,7 +82,7 @@ func prec_above(_ x: Bool, _ y: Bool, _ z: Bool) -> Bool {
8282
return x +>> y ? y +>> z : x +>> y ? y +>> z : x +>> y
8383
}
8484

85-
// CHECK: (func_decl "prec_below(_:_:_:)"
85+
// CHECK: (func_decl{{.*}}"prec_below(_:_:_:)"
8686
func prec_below(_ x: Bool, _ y: Bool, _ z: Bool) -> Bool {
8787
// The middle arm of the ternary is max-munched, so this is:
8888
// ((x +<< (y ? (y +<< z) : x)) +<< (y ? (y +<< z) : x)) +<< y
@@ -102,7 +102,7 @@ func prec_below(_ x: Bool, _ y: Bool, _ z: Bool) -> Bool {
102102
return x +<< y ? y +<< z : x +<< y ? y +<< z : x +<< y
103103
}
104104

105-
// CHECK: (func_decl "prec_equal(_:_:_:)"
105+
// CHECK: (func_decl{{.*}}"prec_equal(_:_:_:)"
106106
func prec_equal(_ x: Bool, _ y: Bool, _ z: Bool) -> Bool {
107107
// The middle arm of the ternary is max-munched, so this is:
108108
// x +== (y ? (y +== z) : (x +== (y ? (y +== z) : (x +== y))))

test/attr/attr_fixed_layout.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
// Public types with @_fixed_layout are always fixed layout
88
//
99

10-
// RESILIENCE-ON: struct_decl "Point" interface type='Point.Type' access=public non-resilient
11-
// RESILIENCE-OFF: struct_decl "Point" interface type='Point.Type' access=public non-resilient
10+
// RESILIENCE-ON: struct_decl{{.*}}"Point" interface type='Point.Type' access=public non-resilient
11+
// RESILIENCE-OFF: struct_decl{{.*}}"Point" interface type='Point.Type' access=public non-resilient
1212
@_fixed_layout public struct Point {
1313
let x, y: Int
1414
}
1515

16-
// RESILIENCE-ON: enum_decl "ChooseYourOwnAdventure" interface type='ChooseYourOwnAdventure.Type' access=public non-resilient
17-
// RESILIENCE-OFF: enum_decl "ChooseYourOwnAdventure" interface type='ChooseYourOwnAdventure.Type' access=public non-resilient
16+
// RESILIENCE-ON: enum_decl{{.*}}"ChooseYourOwnAdventure" interface type='ChooseYourOwnAdventure.Type' access=public non-resilient
17+
// RESILIENCE-OFF: enum_decl{{.*}}"ChooseYourOwnAdventure" interface type='ChooseYourOwnAdventure.Type' access=public non-resilient
1818
@_frozen public enum ChooseYourOwnAdventure {
1919
case JumpIntoRabbitHole
2020
case EatMushroom
@@ -24,14 +24,14 @@
2424
// Public types are resilient when -enable-resilience is on
2525
//
2626

27-
// RESILIENCE-ON: struct_decl "Size" interface type='Size.Type' access=public resilient
28-
// RESILIENCE-OFF: struct_decl "Size" interface type='Size.Type' access=public non-resilient
27+
// RESILIENCE-ON: struct_decl{{.*}}"Size" interface type='Size.Type' access=public resilient
28+
// RESILIENCE-OFF: struct_decl{{.*}}"Size" interface type='Size.Type' access=public non-resilient
2929
public struct Size {
3030
let w, h: Int
3131
}
3232

33-
// RESILIENCE-ON: enum_decl "TaxCredit" interface type='TaxCredit.Type' access=public resilient
34-
// RESILIENCE-OFF: enum_decl "TaxCredit" interface type='TaxCredit.Type' access=public non-resilient
33+
// RESILIENCE-ON: enum_decl{{.*}}"TaxCredit" interface type='TaxCredit.Type' access=public resilient
34+
// RESILIENCE-OFF: enum_decl{{.*}}"TaxCredit" interface type='TaxCredit.Type' access=public non-resilient
3535
public enum TaxCredit {
3636
case EarnedIncome
3737
case MortgageDeduction
@@ -41,8 +41,8 @@ public enum TaxCredit {
4141
// Internal types are always fixed layout
4242
//
4343

44-
// RESILIENCE-ON: struct_decl "Rectangle" interface type='Rectangle.Type' access=internal non-resilient
45-
// RESILIENCE-OFF: struct_decl "Rectangle" interface type='Rectangle.Type' access=internal non-resilient
44+
// RESILIENCE-ON: struct_decl{{.*}}"Rectangle" interface type='Rectangle.Type' access=internal non-resilient
45+
// RESILIENCE-OFF: struct_decl{{.*}}"Rectangle" interface type='Rectangle.Type' access=internal non-resilient
4646
struct Rectangle {
4747
let topLeft: Point
4848
let bottomRight: Size

test/attr/attr_objc.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,14 +2038,14 @@ class ClassThrows1 {
20382038
}
20392039

20402040

2041-
// CHECK-DUMP-LABEL: class_decl "ImplicitClassThrows1"
2041+
// CHECK-DUMP-LABEL: class_decl{{.*}}"ImplicitClassThrows1"
20422042
@objc class ImplicitClassThrows1 {
20432043
// CHECK: @objc func methodReturnsVoid() throws
2044-
// CHECK-DUMP: func_decl "methodReturnsVoid()"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2044+
// CHECK-DUMP: func_decl{{.*}}"methodReturnsVoid()"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
20452045
func methodReturnsVoid() throws { }
20462046

20472047
// CHECK: @objc func methodReturnsObjCClass() throws -> Class_ObjC1
2048-
// CHECK-DUMP: func_decl "methodReturnsObjCClass()" {{.*}}foreign_error=NilResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>
2048+
// CHECK-DUMP: func_decl{{.*}}"methodReturnsObjCClass()" {{.*}}foreign_error=NilResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>
20492049
func methodReturnsObjCClass() throws -> Class_ObjC1 {
20502050
return Class_ObjC1()
20512051
}
@@ -2060,11 +2060,11 @@ class ClassThrows1 {
20602060
func methodReturnsOptionalObjCClass() throws -> Class_ObjC1? { return nil }
20612061

20622062
// CHECK: @objc func methodWithTrailingClosures(_ s: String, fn1: @escaping ((Int) -> Int), fn2: @escaping (Int) -> Int, fn3: @escaping (Int) -> Int)
2063-
// CHECK-DUMP: func_decl "methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2063+
// CHECK-DUMP: func_decl{{.*}}"methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
20642064
func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int, fn3: @escaping (Int) -> Int) throws { }
20652065

20662066
// CHECK: @objc init(degrees: Double) throws
2067-
// CHECK-DUMP: constructor_decl "init(degrees:)"{{.*}}foreign_error=NilResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>
2067+
// CHECK-DUMP: constructor_decl{{.*}}"init(degrees:)"{{.*}}foreign_error=NilResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>
20682068
init(degrees: Double) throws { }
20692069

20702070
// CHECK: {{^}} func methodReturnsBridgedValueType() throws -> NSRange
@@ -2086,10 +2086,10 @@ class ClassThrows1 {
20862086
}
20872087
}
20882088

2089-
// CHECK-DUMP-LABEL: class_decl "SubclassImplicitClassThrows1"
2089+
// CHECK-DUMP-LABEL: class_decl{{.*}}"SubclassImplicitClassThrows1"
20902090
@objc class SubclassImplicitClassThrows1 : ImplicitClassThrows1 {
20912091
// CHECK: @objc override func methodWithTrailingClosures(_ s: String, fn1: @escaping ((Int) -> Int), fn2: @escaping ((Int) -> Int), fn3: @escaping ((Int) -> Int))
2092-
// CHECK-DUMP: func_decl "methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2092+
// CHECK-DUMP: func_decl{{.*}}"methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
20932093
override func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: (@escaping (Int) -> Int), fn3: (@escaping (Int) -> Int)) throws { }
20942094
}
20952095

@@ -2122,20 +2122,20 @@ class ThrowsObjCName {
21222122

21232123
@objc(method7) func method7(x: Int) throws { } // expected-error{{@objc' method name provides names for 0 arguments, but method has 2 parameters (including the error parameter)}}
21242124

2125-
// CHECK-DUMP: func_decl "method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2125+
// CHECK-DUMP: func_decl{{.*}}"method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
21262126
@objc(method8:fn1:error:fn2:)
21272127
func method8(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
21282128

2129-
// CHECK-DUMP: func_decl "method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2129+
// CHECK-DUMP: func_decl{{.*}}"method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
21302130
@objc(method9AndReturnError:s:fn1:fn2:)
21312131
func method9(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
21322132
}
21332133

21342134
class SubclassThrowsObjCName : ThrowsObjCName {
2135-
// CHECK-DUMP: func_decl "method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2135+
// CHECK-DUMP: func_decl{{.*}}"method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
21362136
override func method8(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
21372137

2138-
// CHECK-DUMP: func_decl "method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
2138+
// CHECK-DUMP: func_decl{{.*}}"method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
21392139
override func method9(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
21402140
}
21412141

test/decl/protocol/associated_type_overrides.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ protocol P1 {
44
associatedtype A
55
}
66

7-
// CHECK-LABEL: protocol "P2"
8-
// CHECK-NEXT: (associated_type_decl "A" {{.*}} overridden=P1))
7+
// CHECK-LABEL: (protocol{{.*}}"P2"
8+
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden=P1))
99
protocol P2 : P1 {
1010
associatedtype A
1111
}
@@ -14,14 +14,14 @@ protocol P3 {
1414
associatedtype A
1515
}
1616

17-
// CHECK-LABEL: protocol "P4"
18-
// CHECK-NEXT: (associated_type_decl "A" {{.*}} overridden=P2, P3))
17+
// CHECK-LABEL: (protocol{{.*}}"P4"
18+
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden=P2, P3))
1919
protocol P4 : P2, P3 {
2020
associatedtype A
2121
}
2222

23-
// CHECK-LABEL: protocol "P5"
24-
// CHECK-NEXT: (associated_type_decl "A" {{.*}} overridden=P4))
23+
// CHECK-LABEL: (protocol{{.*}}"P5"
24+
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden=P4))
2525
protocol P5 : P4, P2 {
2626
associatedtype A
2727
}

test/decl/protocol/conforms/nscoding.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import Foundation
1313

1414
// Top-level classes
15-
// CHECK-NOT: class_decl "CodingA"{{.*}}@_staticInitializeObjCMetadata
15+
// CHECK-NOT: class_decl{{.*}}"CodingA"{{.*}}@_staticInitializeObjCMetadata
1616
class CodingA : NSObject, NSCoding {
1717
required init(coder: NSCoder) { }
1818
func encode(coder: NSCoder) { }
@@ -21,7 +21,7 @@ class CodingA : NSObject, NSCoding {
2121

2222
// Nested classes
2323
extension CodingA {
24-
// CHECK-NOT: class_decl "NestedA"{{.*}}@_staticInitializeObjCMetadata
24+
// CHECK-NOT: class_decl{{.*}}"NestedA"{{.*}}@_staticInitializeObjCMetadata
2525
class NestedA : NSObject, NSCoding { // expected-error{{nested class 'CodingA.NestedA' has an unstable name when archiving via 'NSCoding'}}
2626
// expected-note@-1{{for compatibility with existing archives, use '@objc' to record the Swift 3 runtime name}}{{3-3=@objc(_TtCC8nscoding7CodingA7NestedA)}}
2727
// expected-note@-2{{for new classes, use '@objc' to specify a unique, prefixed Objective-C runtime name}}{{3-3=@objc(<#prefixed Objective-C class name#>)}}
@@ -36,14 +36,14 @@ extension CodingA {
3636
func encode(coder: NSCoder) { }
3737
}
3838

39-
// CHECK-NOT: class_decl "NestedC"{{.*}}@_staticInitializeObjCMetadata
39+
// CHECK-NOT: class_decl{{.*}}"NestedC"{{.*}}@_staticInitializeObjCMetadata
4040
@objc(CodingA_NestedC)
4141
class NestedC : NSObject, NSCoding {
4242
required init(coder: NSCoder) { }
4343
func encode(coder: NSCoder) { }
4444
}
4545

46-
// CHECK-NOT: class_decl "NestedD"{{.*}}@_staticInitializeObjCMetadata
46+
// CHECK-NOT: class_decl{{.*}}"NestedD"{{.*}}@_staticInitializeObjCMetadata
4747
@objc(CodingA_NestedD)
4848
class NestedD : NSObject {
4949
required init(coder: NSCoder) { }
@@ -58,7 +58,7 @@ extension CodingA.NestedD: NSCoding { // okay
5858
}
5959

6060
// Generic classes
61-
// CHECK-NOT: class_decl "CodingB"{{.*}}@_staticInitializeObjCMetadata
61+
// CHECK-NOT: class_decl{{.*}}"CodingB"{{.*}}@_staticInitializeObjCMetadata
6262
class CodingB<T> : NSObject, NSCoding {
6363
required init(coder: NSCoder) { }
6464
func encode(coder: NSCoder) { }
@@ -72,7 +72,7 @@ extension CodingB {
7272
}
7373

7474
// Fileprivate classes.
75-
// CHECK-NOT: class_decl "CodingC"{{.*}}@_staticInitializeObjCMetadata
75+
// CHECK-NOT: class_decl{{.*}}"CodingC"{{.*}}@_staticInitializeObjCMetadata
7676
fileprivate class CodingC : NSObject, NSCoding { // expected-error{{fileprivate class 'CodingC' has an unstable name when archiving via 'NSCoding'}}
7777
// expected-note@-1{{for compatibility with existing archives, use '@objc' to record the Swift 3 runtime name}}{{1-1=@objc(_TtC8nscodingP33_0B4E7641C0BD1F170280EEDD0D0C1F6C7CodingC)}}
7878
// expected-note@-2{{for new classes, use '@objc' to specify a unique, prefixed Objective-C runtime name}}{{1-1=@objc(<#prefixed Objective-C class name#>)}}
@@ -99,7 +99,7 @@ func someFunction() {
9999
}
100100

101101
// Inherited conformances.
102-
// CHECK-NOT: class_decl "CodingE"{{.*}}@_staticInitializeObjCMetadata
102+
// CHECK-NOT: class_decl{{.*}}"CodingE"{{.*}}@_staticInitializeObjCMetadata
103103
class CodingE<T> : CodingB<T> {
104104
required init(coder: NSCoder) { super.init(coder: coder) }
105105
override func encode(coder: NSCoder) { }
@@ -119,24 +119,24 @@ private class CodingG : NSObject, NSCoding {
119119
}
120120

121121
extension CodingB {
122-
// CHECK-NOT: class_decl "GenericViaScope"{{.*}}@_staticInitializeObjCMetadata
122+
// CHECK-NOT: class_decl{{.*}}"GenericViaScope"{{.*}}@_staticInitializeObjCMetadata
123123
@objc(GenericViaScope) // expected-error {{generic subclasses of '@objc' classes cannot have an explicit '@objc' because they are not directly visible from Objective-C}}
124124
class GenericViaScope : NSObject { }
125125
}
126126

127127
// Inference of @_staticInitializeObjCMetadata.
128-
// CHECK-NOT: class_decl "SubclassOfCodingA"{{.*}}@_staticInitializeObjCMetadata
128+
// CHECK-NOT: class_decl{{.*}}"SubclassOfCodingA"{{.*}}@_staticInitializeObjCMetadata
129129
class SubclassOfCodingA : CodingA { }
130130

131-
// CHECK: class_decl "SubclassOfCodingE"{{.*}}@_staticInitializeObjCMetadata
131+
// CHECK: class_decl{{.*}}"SubclassOfCodingE"{{.*}}@_staticInitializeObjCMetadata
132132
class SubclassOfCodingE : CodingE<Int> { }
133133

134134
// Do not warn when simply inheriting from classes that conform to NSCoding.
135135
// The subclass may never be serialized. But do still infer static
136136
// initialization, just in case.
137-
// CHECK-NOT: class_decl "PrivateSubclassOfCodingA"{{.*}}@_staticInitializeObjCMetadata
137+
// CHECK-NOT: class_decl{{.*}}"PrivateSubclassOfCodingA"{{.*}}@_staticInitializeObjCMetadata
138138
private class PrivateSubclassOfCodingA : CodingA { }
139-
// CHECK: class_decl "PrivateSubclassOfCodingE"{{.*}}@_staticInitializeObjCMetadata
139+
// CHECK: class_decl{{.*}}"PrivateSubclassOfCodingE"{{.*}}@_staticInitializeObjCMetadata
140140
private class PrivateSubclassOfCodingE : CodingE<Int> { }
141141

142142
// But do warn when inherited through a protocol.

test/decl/protocol/conforms/nscoding_availability_osx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class CodingI : NSObject, NSCoding {
1717

1818
@available(OSX 10.51, *)
1919
class OuterCodingJ {
20-
// CHECK-NOT: class_decl "NestedJ"{{.*}}@_staticInitializeObjCMetadata
20+
// CHECK-NOT: class_decl{{.*}}"NestedJ"{{.*}}@_staticInitializeObjCMetadata
2121
class NestedJ : CodingI { }
2222
}

test/expr/capture/dynamic_self.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
22

3-
// CHECK: func_decl "clone()" interface type='(Android) -> () -> Self'
3+
// CHECK: func_decl{{.*}}"clone()" interface type='(Android) -> () -> Self'
44

55
class Android {
66
func clone() -> Self {

0 commit comments

Comments
 (0)