[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-16 Thread via cfe-commits

https://github.com/QuietMisdreavus closed 
https://github.com/llvm/llvm-project/pull/119925
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-13 Thread Zixu Wang via cfe-commits

https://github.com/zixu-w approved this pull request.

LGTM!

https://github.com/llvm/llvm-project/pull/119925
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-13 Thread via cfe-commits

https://github.com/QuietMisdreavus updated 
https://github.com/llvm/llvm-project/pull/119925

>From 1ab5e1c6d1dcf2bfbaa517bdb9d90f6007debce4 Mon Sep 17 00:00:00 2001
From: Vera Mitchell 
Date: Fri, 13 Dec 2024 13:47:18 -0700
Subject: [PATCH] reorder the module names in extension symbol graph file names

rdar://140298287
---
 .../ExtractAPI/Serialization/SymbolGraphSerializer.cpp   | 5 ++---
 clang/test/ExtractAPI/objc_external_category.m   | 9 -
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index c730c062b6a1d5..e881d56258e5e4 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -1067,9 +1067,8 @@ void SymbolGraphSerializer::serializeWithExtensionGraphs(
 
   for (auto &ExtensionSGF : Serializer.ExtendedModules) {
 if (auto ExtensionOS =
-CreateOutputStream(ExtensionSGF.getKey() + "@" + API.ProductName))
-  Serializer.serializeGraphToStream(*ExtensionOS, Options,
-ExtensionSGF.getKey(),
+CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
+  Serializer.serializeGraphToStream(*ExtensionOS, Options, API.ProductName,
 std::move(ExtensionSGF.getValue()));
   }
 }
diff --git a/clang/test/ExtractAPI/objc_external_category.m 
b/clang/test/ExtractAPI/objc_external_category.m
index 8afc92489f28b6..1947237d088e8f 100644
--- a/clang/test/ExtractAPI/objc_external_category.m
+++ b/clang/test/ExtractAPI/objc_external_category.m
@@ -46,7 +46,7 @@ @interface ExtInterface
 // Symbol graph from the build without extension SGFs should be identical to 
main symbol graph with extension SGFs
 // RUN: diff %t/symbols/Module.symbols.json %t/ModuleNoExt.symbols.json
 
-// RUN: FileCheck %s --input-file 
%t/symbols/externalmod...@module.symbols.json --check-prefix EXT
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix EXT
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ 
c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ 
c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod 
$ c:objc(cs)ExtInterface"
@@ -55,3 +55,10 @@ @interface ExtInterface
 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
 // EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
 // EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
+
+// Ensure that the 'module' metadata for the extension symbol graph should 
still reference the
+// declaring module
+
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix META
+// META:   "module": {
+// META-NEXT:"name": "Module",

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-13 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 91f5f974cb75309a94c9efc76238ef98abcf1582 
506ac691d11e5658932f0f9388059f13407011cd --extensions cpp -- 
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 2c70e77b62..e881d56258 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -1068,8 +1068,7 @@ void SymbolGraphSerializer::serializeWithExtensionGraphs(
   for (auto &ExtensionSGF : Serializer.ExtendedModules) {
 if (auto ExtensionOS =
 CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
-  Serializer.serializeGraphToStream(*ExtensionOS, Options,
-API.ProductName,
+  Serializer.serializeGraphToStream(*ExtensionOS, Options, API.ProductName,
 std::move(ExtensionSGF.getValue()));
   }
 }

``




https://github.com/llvm/llvm-project/pull/119925
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: QuietMisdreavus (QuietMisdreavus)


Changes

Resolves rdar://140298287

ExtractAPI's support for printing Objective-C category extensions from other 
modules emits symbol graphs with an `ExtendedModule@HostModule.symbols.json`. 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.

---
Full diff: https://github.com/llvm/llvm-project/pull/119925.diff


2 Files Affected:

- (modified) clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
(+2-2) 
- (modified) clang/test/ExtractAPI/objc_external_category.m (+8-1) 


``diff
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index c730c062b6a1d5..2c70e77b6246c6 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -1067,9 +1067,9 @@ void SymbolGraphSerializer::serializeWithExtensionGraphs(
 
   for (auto &ExtensionSGF : Serializer.ExtendedModules) {
 if (auto ExtensionOS =
-CreateOutputStream(ExtensionSGF.getKey() + "@" + API.ProductName))
+CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
   Serializer.serializeGraphToStream(*ExtensionOS, Options,
-ExtensionSGF.getKey(),
+API.ProductName,
 std::move(ExtensionSGF.getValue()));
   }
 }
diff --git a/clang/test/ExtractAPI/objc_external_category.m 
b/clang/test/ExtractAPI/objc_external_category.m
index 8afc92489f28b6..1947237d088e8f 100644
--- a/clang/test/ExtractAPI/objc_external_category.m
+++ b/clang/test/ExtractAPI/objc_external_category.m
@@ -46,7 +46,7 @@ @interface ExtInterface
 // Symbol graph from the build without extension SGFs should be identical to 
main symbol graph with extension SGFs
 // RUN: diff %t/symbols/Module.symbols.json %t/ModuleNoExt.symbols.json
 
-// RUN: FileCheck %s --input-file 
%t/symbols/externalmod...@module.symbols.json --check-prefix EXT
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix EXT
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ 
c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ 
c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod 
$ c:objc(cs)ExtInterface"
@@ -55,3 +55,10 @@ @interface ExtInterface
 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
 // EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
 // EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
+
+// Ensure that the 'module' metadata for the extension symbol graph should 
still reference the
+// declaring module
+
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix META
+// META:   "module": {
+// META-NEXT:"name": "Module",

``




https://github.com/llvm/llvm-project/pull/119925
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-13 Thread via cfe-commits

https://github.com/QuietMisdreavus created 
https://github.com/llvm/llvm-project/pull/119925

Resolves rdar://140298287

ExtractAPI's support for printing Objective-C category extensions from other 
modules emits symbol graphs with an `extendedmod...@hostmodule.symbols.json`. 
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.

>From 506ac691d11e5658932f0f9388059f13407011cd Mon Sep 17 00:00:00 2001
From: Vera Mitchell 
Date: Fri, 13 Dec 2024 13:47:18 -0700
Subject: [PATCH] reorder the module names in extension symbol graph file names

rdar://140298287
---
 .../ExtractAPI/Serialization/SymbolGraphSerializer.cpp   | 4 ++--
 clang/test/ExtractAPI/objc_external_category.m   | 9 -
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index c730c062b6a1d5..2c70e77b6246c6 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -1067,9 +1067,9 @@ void SymbolGraphSerializer::serializeWithExtensionGraphs(
 
   for (auto &ExtensionSGF : Serializer.ExtendedModules) {
 if (auto ExtensionOS =
-CreateOutputStream(ExtensionSGF.getKey() + "@" + API.ProductName))
+CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
   Serializer.serializeGraphToStream(*ExtensionOS, Options,
-ExtensionSGF.getKey(),
+API.ProductName,
 std::move(ExtensionSGF.getValue()));
   }
 }
diff --git a/clang/test/ExtractAPI/objc_external_category.m 
b/clang/test/ExtractAPI/objc_external_category.m
index 8afc92489f28b6..1947237d088e8f 100644
--- a/clang/test/ExtractAPI/objc_external_category.m
+++ b/clang/test/ExtractAPI/objc_external_category.m
@@ -46,7 +46,7 @@ @interface ExtInterface
 // Symbol graph from the build without extension SGFs should be identical to 
main symbol graph with extension SGFs
 // RUN: diff %t/symbols/Module.symbols.json %t/ModuleNoExt.symbols.json
 
-// RUN: FileCheck %s --input-file 
%t/symbols/externalmod...@module.symbols.json --check-prefix EXT
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix EXT
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ 
c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ 
c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod 
$ c:objc(cs)ExtInterface"
@@ -55,3 +55,10 @@ @interface ExtInterface
 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
 // EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
 // EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
+
+// Ensure that the 'module' metadata for the extension symbol graph should 
still reference the
+// declaring module
+
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix META
+// META:   "module": {
+// META-NEXT:"name": "Module",

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits