Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/SymbolGraphGen/FormatVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H

#define SWIFT_SYMBOLGRAPH_FORMAT_MAJOR 0
#define SWIFT_SYMBOLGRAPH_FORMAT_MINOR 6
#define SWIFT_SYMBOLGRAPH_FORMAT_MINOR 7
#define SWIFT_SYMBOLGRAPH_FORMAT_PATCH 0

#endif // SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H
14 changes: 12 additions & 2 deletions lib/SymbolGraphGen/SymbolGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,16 +624,26 @@ void SymbolGraph::serialize(llvm::json::OStream &OS) {
}); // end metadata:

OS.attributeObject("module", [&](){
std::string ModuleName;
if (DeclaringModule) {
// A cross-import overlay can be considered part of its declaring module
OS.attribute("name", getFullModuleName(*DeclaringModule));
ModuleName = getFullModuleName(*DeclaringModule);
OS.attribute("name", ModuleName);
std::vector<StringRef> B;
for (auto BModule : BystanderModules) {
B.push_back(BModule.str());
}
OS.attribute("bystanders", B);
} else {
OS.attribute("name", getFullModuleName(&M));
ModuleName = getFullModuleName(&M);
OS.attribute("name", ModuleName);
}
if (ExtendedModule) {
OS.attribute("extended", getFullModuleName(*ExtendedModule));
} else {
// When the symbol graph isn't extending another module, signal that to the reader by
// repeating the source module's name.
OS.attribute("extended", ModuleName);
}
AttributeRAII Platform("platform", OS);

Expand Down
1 change: 1 addition & 0 deletions test/SymbolGraph/Module/BasicExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extension String {
// ALL-LABEL: module

// ALL: {{"name": ?"BasicExtension"}}
// ALL: {{"extended": ?"Swift"}}


// Check for Symbols and Documentation Strings:
Expand Down
1 change: 1 addition & 0 deletions test/SymbolGraph/Module/Module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public struct S {

// CHECK: module
// CHECK-NEXT: "name": "SymbolGraphModule"
// CHECK-NEXT: "extended": "SymbolGraphModule"
// CHECK-NEXT: platform
// CHECK-NEXT: architecture
// CHECK: vendor
Expand Down
1 change: 1 addition & 0 deletions test/SymbolGraph/Module/NestedExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ extension AStruct.BStruct.CStruct where Thing: Equatable {
// NESTED-NOT: BStruct
// NESTED-NOT: CStruct
// NESTED-NOT: "swift.extension"
// NESTEDATA-DAG: "extended": "A"
// NESTEDATA-DAG: "precise": "s:1A7AStructV1BE7BStructV16NestedExtensionsE7CStructV"
// NESTEDATA-DAG: "precise": "s:e:s:1A7AStructV1BE7BStructV16NestedExtensionsE7CStructV"