File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed
test/SymbolGraph/Relationships/Synthesized Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -57,5 +57,21 @@ void Edge::serialize(llvm::json::OStream &OS) const {
57
57
});
58
58
}
59
59
}
60
+
61
+ // If our source symbol is a synthesized decl, write in information about
62
+ // where it's inheriting docs from.
63
+ if (Source.getSynthesizedBaseTypeDecl ()) {
64
+ Symbol inheritedSym (Graph, Source.getSymbolDecl (), nullptr );
65
+ SmallString<256 > USR, Display;
66
+ llvm::raw_svector_ostream DisplayOS (Display);
67
+
68
+ inheritedSym.getUSR (USR);
69
+ inheritedSym.printPath (DisplayOS);
70
+
71
+ OS.attributeObject (" sourceOrigin" , [&](){
72
+ OS.attribute (" identifier" , USR.str ());
73
+ OS.attribute (" displayName" , Display.str ());
74
+ });
75
+ }
60
76
});
61
77
}
Original file line number Diff line number Diff line change 15
15
16
16
#define SWIFT_SYMBOLGRAPH_FORMAT_MAJOR 0
17
17
#define SWIFT_SYMBOLGRAPH_FORMAT_MINOR 5
18
- #define SWIFT_SYMBOLGRAPH_FORMAT_PATCH 2
18
+ #define SWIFT_SYMBOLGRAPH_FORMAT_PATCH 3
19
19
20
20
#endif // SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-build-swift %s -module-name InheritedDocs -emit-module -emit-module-path %t/
3
+ // RUN: %target-swift-symbolgraph-extract -module-name InheritedDocs -I %t -pretty-print -output-dir %t
4
+ // RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json
5
+
6
+ // CHECK: "source": "s:13InheritedDocs1PPAAE8someFuncyyF::SYNTHESIZED::s:13InheritedDocs1SV"
7
+ // CHECK-NEXT: "target": "s:13InheritedDocs1SV"
8
+ // CHECK-NEXT: "sourceOrigin": {
9
+ // CHECK-NEXT: "identifier": "s:13InheritedDocs1PPAAE8someFuncyyF"
10
+ // CHECK-NEXT: "displayName": "P.someFunc()"
11
+ // CHECK-NEXT: }
12
+
13
+ /// Protocol P
14
+ public protocol P {
15
+ /// Some Function
16
+ func someFunc( )
17
+ }
18
+
19
+ public extension P {
20
+ func someFunc( ) { }
21
+ }
22
+
23
+ public struct S : P {
24
+ }
You can’t perform that action at this time.
0 commit comments