Files
swift-mirror/test/SourceKit/CursorInfo/mixed_framework.swift
Alex Hoppen 5d3fb8f26d [SymbolGraph] Fix crasher when retrieving cursor info of method defined in ObjC
In a mixed Objective-C / Swift module, we have a Clang module overlay that’s a Source file, not a serialized AST as is currently assumed. That assumption caused a crash when retrieving the symbol graph as part of a cursor info request to SourceKit, which was invoked on a method defined in the Objective-C part of the module.

To fix the crash, recursively use the same logic that already exists to serialize a module to also serialize the clang overlay module since that function alreayd correctly handles the distinction between source files and serialized ASTs.

Resolves rdar://76951147
2021-04-29 17:54:18 +02:00

10 lines
360 B
Swift

// RUN: %empty-directory(%t.mcp)
public class MySwiftType {
public func bar(x: MyObjcType) {
// Check that we don't crash
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):11 -req-opts=retrieve_symbol_graph=1 %s -- -module-name MixedFramework -F %S/Inputs/mixed_framework -import-underlying-module -module-cache-path %t.mcp %s
x.foo()
}
}