Skip to content

Commit 0d3ad36

Browse files
[ExtractAPI] reorder the module names in extension symbol graph file names (llvm#119925)
Resolves rdar://140298287 ExtractAPI's support for printing Objective-C category extensions from other modules emits symbol graphs with an `[email protected]`. However, this is backwards from existing symbol graph practices, causing issues when these symbol graphs are consumed alongside symbol graphs generated with other tools like Swift. This PR flips the naming scheme to be in line with existing symbol graph tooling.
1 parent 1b38440 commit 0d3ad36

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,9 +1068,8 @@ void SymbolGraphSerializer::serializeWithExtensionGraphs(
10681068

10691069
for (auto &ExtensionSGF : Serializer.ExtendedModules) {
10701070
if (auto ExtensionOS =
1071-
CreateOutputStream(ExtensionSGF.getKey() + "@" + API.ProductName))
1072-
Serializer.serializeGraphToStream(*ExtensionOS, Options,
1073-
ExtensionSGF.getKey(),
1071+
CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
1072+
Serializer.serializeGraphToStream(*ExtensionOS, Options, API.ProductName,
10741073
std::move(ExtensionSGF.getValue()));
10751074
}
10761075
}

clang/test/ExtractAPI/objc_external_category.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ @interface ExtInterface
4646
// Symbol graph from the build without extension SGFs should be identical to main symbol graph with extension SGFs
4747
// RUN: diff %t/symbols/Module.symbols.json %t/ModuleNoExt.symbols.json
4848

49-
// RUN: FileCheck %s --input-file %t/symbols/ExternalModule@Module.symbols.json --check-prefix EXT
49+
// RUN: FileCheck %s --input-file %t/symbols/Module@ExternalModule.symbols.json --check-prefix EXT
5050
// EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ c:objc(cs)ExtInterface"
5151
// EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
5252
// EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod $ c:objc(cs)ExtInterface"
@@ -55,3 +55,10 @@ @interface ExtInterface
5555
// EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
5656
// EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
5757
// EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
58+
59+
// Ensure that the 'module' metadata for the extension symbol graph should still reference the
60+
// declaring module
61+
62+
// RUN: FileCheck %s --input-file %t/symbols/[email protected] --check-prefix META
63+
// META: "module": {
64+
// META-NEXT: "name": "Module",

0 commit comments

Comments
 (0)