Skip to content

Commit f23c24f

Browse files
author
Nathan Hawes
committed
[SourceKit] Return a default UID in getUIDForSyntaxNodeKind()
Assert 0 and return a default kind, rather than calling unreachable as a defensive fix for rdar://problem/53343735.
1 parent 218f490 commit f23c24f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,9 @@ UIdent SwiftLangSupport::getUIDForSyntaxNodeKind(SyntaxNodeKind SC) {
467467
return KindObjectLiteral;
468468
}
469469

470-
llvm_unreachable("Unhandled SyntaxNodeKind in switch.");
470+
// Default to a known kind to prevent crashing in non-asserts builds
471+
assert(0 && "Unhandled SyntaxNodeKind in switch.");
472+
return KindIdentifier;
471473
}
472474

473475
UIdent SwiftLangSupport::getUIDForSyntaxStructureKind(

0 commit comments

Comments
 (0)