Skip to content

Commit 2b4bf81

Browse files
committed
Parser: Don't skip nested protocols for LLDB
1 parent 1b09886 commit 2b4bf81

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5623,7 +5623,8 @@ static unsigned skipUntilMatchingRBrace(Parser &P,
56235623
tok::pound_if, tok::pound_else, tok::pound_endif, tok::pound_elseif);
56245624

56255625
HasNestedTypeDeclarations |= P.Tok.isAny(tok::kw_class, tok::kw_struct,
5626-
tok::kw_enum, tok::kw_typealias)
5626+
tok::kw_enum, tok::kw_typealias,
5627+
tok::kw_protocol)
56275628
|| P.Tok.isContextualKeyword("actor");
56285629

56295630
// HACK: Bail if we encounter what could potentially be a regex literal.

test/Frontend/skip-function-bodies.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ public func funcPublicWithNestedTypeActor() {
217217
// CHECK-SIL-SKIP-NONINLINE-NOT: "funcPublicWithNestedTypeActor()"
218218
// CHECK-SIL-SKIP-WITHOUTTYPES: "funcPublicWithNestedTypeActor()"
219219

220+
public func funcPublicWithNestedTypeProtocol() {
221+
let INLINENOTYPECHECK_local = "funcPublicWithNestedTypeProtocol()"
222+
_blackHole(INLINENOTYPECHECK_local)
223+
protocol P {}
224+
}
225+
// CHECK-TEXTUAL-NOT: "funcPublicWithNestedTypeProtocol()"
226+
// CHECK-SIL-NO-SKIP: "funcPublicWithNestedTypeProtocol()"
227+
// CHECK-SIL-SKIP-NONINLINE-NOT: "funcPublicWithNestedTypeProtocol()"
228+
// CHECK-SIL-SKIP-WITHOUTTYPES: "funcPublicWithNestedTypeProtocol()"
229+
220230
public func funcPublicWithNestedTypeStruct() {
221231
let INLINENOTYPECHECK_local = "funcPublicWithNestedTypeStruct()"
222232
_blackHole(INLINENOTYPECHECK_local)

0 commit comments

Comments
 (0)