dang created this revision.
dang added reviewers: zixuw, QuietMisdreavus.
Herald added a project: All.
dang requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123391

Files:
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/test/ExtractAPI/enum.c
  clang/test/ExtractAPI/global_record.c
  clang/test/ExtractAPI/global_record_multifile.c
  clang/test/ExtractAPI/known_files_only.c
  clang/test/ExtractAPI/known_files_only_hmap.c
  clang/test/ExtractAPI/language.c
  clang/test/ExtractAPI/macro_undefined.c
  clang/test/ExtractAPI/macros.c
  clang/test/ExtractAPI/objc_category.m
  clang/test/ExtractAPI/objc_interface.m
  clang/test/ExtractAPI/objc_protocol.m
  clang/test/ExtractAPI/struct.c
  clang/test/ExtractAPI/typedef.c
  clang/test/ExtractAPI/typedef_anonymous_record.c
  clang/test/ExtractAPI/typedef_chain.c

Index: clang/test/ExtractAPI/typedef_chain.c
===================================================================
--- clang/test/ExtractAPI/typedef_chain.c
+++ clang/test/ExtractAPI/typedef_chain.c
@@ -86,6 +86,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyInt"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -140,6 +146,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyIntInt"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -194,6 +206,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyIntIntInt"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/typedef_anonymous_record.c
===================================================================
--- clang/test/ExtractAPI/typedef_anonymous_record.c
+++ clang/test/ExtractAPI/typedef_anonymous_record.c
@@ -85,6 +85,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyStruct"
+          }
+        ],
         "title": "MyStruct"
       },
       "pathComponents": [
@@ -132,6 +138,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyStructStruct"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -186,6 +198,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyStructStructStruct"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/typedef.c
===================================================================
--- clang/test/ExtractAPI/typedef.c
+++ clang/test/ExtractAPI/typedef.c
@@ -84,6 +84,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MyInt"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/struct.c
===================================================================
--- clang/test/ExtractAPI/struct.c
+++ clang/test/ExtractAPI/struct.c
@@ -120,6 +120,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Color"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -165,6 +171,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Red"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -211,6 +223,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Green"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -257,6 +275,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Blue"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -320,6 +344,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Alpha"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/objc_protocol.m
===================================================================
--- clang/test/ExtractAPI/objc_protocol.m
+++ clang/test/ExtractAPI/objc_protocol.m
@@ -85,6 +85,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Protocol"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -142,6 +148,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "AnotherProtocol"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/objc_interface.m
===================================================================
--- clang/test/ExtractAPI/objc_interface.m
+++ clang/test/ExtractAPI/objc_interface.m
@@ -117,6 +117,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Super"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -186,6 +192,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "getWithProperty:"
+          }
+        ],
         "subHeading": [
           {
             "kind": "text",
@@ -272,6 +284,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Property"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -326,6 +344,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Derived"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -371,6 +395,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Ivar"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -425,6 +455,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "getIvar"
+          }
+        ],
         "subHeading": [
           {
             "kind": "text",
Index: clang/test/ExtractAPI/objc_category.m
===================================================================
--- clang/test/ExtractAPI/objc_category.m
+++ clang/test/ExtractAPI/objc_category.m
@@ -105,6 +105,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Interface"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -158,6 +164,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "InstanceMethod"
+          }
+        ],
         "subHeading": [
           {
             "kind": "text",
@@ -216,6 +228,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "ClassMethod"
+          }
+        ],
         "subHeading": [
           {
             "kind": "text",
@@ -302,6 +320,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Property"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/macros.c
===================================================================
--- clang/test/ExtractAPI/macros.c
+++ clang/test/ExtractAPI/macros.c
@@ -80,6 +80,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "HELLO"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -124,6 +130,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "WORLD"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -180,6 +192,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "MACRO_FUN"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -252,6 +270,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "FUN"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -308,6 +332,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "FUNC99"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -364,6 +394,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "FUNGNU"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/macro_undefined.c
===================================================================
--- clang/test/ExtractAPI/macro_undefined.c
+++ clang/test/ExtractAPI/macro_undefined.c
@@ -95,6 +95,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "foo"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -241,6 +247,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "bar"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -285,6 +297,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "HELLO"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/language.c
===================================================================
--- clang/test/ExtractAPI/language.c
+++ clang/test/ExtractAPI/language.c
@@ -88,6 +88,12 @@
         "uri": "file://INPUT_DIR/c.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "c"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -162,6 +168,12 @@
         "uri": "file://INPUT_DIR/objc.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "objc"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/known_files_only_hmap.c
===================================================================
--- clang/test/ExtractAPI/known_files_only_hmap.c
+++ clang/test/ExtractAPI/known_files_only_hmap.c
@@ -103,6 +103,12 @@
         "uri": "file://INPUT_DIR/subdir/subdir1/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "num"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -148,6 +154,12 @@
         "uri": "file://INPUT_DIR/subdir/subdir2/known_file.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "known_num"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/known_files_only.c
===================================================================
--- clang/test/ExtractAPI/known_files_only.c
+++ clang/test/ExtractAPI/known_files_only.c
@@ -84,6 +84,12 @@
         "uri": "file://INPUT_DIR/input1.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "num"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/global_record_multifile.c
===================================================================
--- clang/test/ExtractAPI/global_record_multifile.c
+++ clang/test/ExtractAPI/global_record_multifile.c
@@ -88,6 +88,12 @@
         "uri": "file://INPUT_DIR/input1.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "num"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -367,6 +373,12 @@
         "uri": "file://INPUT_DIR/input2.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "add"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/global_record.c
===================================================================
--- clang/test/ExtractAPI/global_record.c
+++ clang/test/ExtractAPI/global_record.c
@@ -86,6 +86,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "num"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -365,6 +371,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "add"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/test/ExtractAPI/enum.c
===================================================================
--- clang/test/ExtractAPI/enum.c
+++ clang/test/ExtractAPI/enum.c
@@ -161,6 +161,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Vehicle"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -197,6 +203,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Bicycle"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -234,6 +246,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Car"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -288,6 +306,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Train"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -325,6 +349,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Ship"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -362,6 +392,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Airplane"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -416,6 +452,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "Direction"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -452,6 +494,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "North"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -489,6 +537,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "East"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -526,6 +580,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "South"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
@@ -563,6 +623,12 @@
         "uri": "file://INPUT_DIR/input.h"
       },
       "names": {
+        "navigator": [
+          {
+            "kind": "identifier",
+            "spelling": "West"
+          }
+        ],
         "subHeading": [
           {
             "kind": "identifier",
Index: clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
===================================================================
--- clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -14,6 +14,7 @@
 #include "clang/ExtractAPI/Serialization/SymbolGraphSerializer.h"
 #include "clang/Basic/Version.h"
 #include "clang/ExtractAPI/API.h"
+#include "clang/ExtractAPI/DeclarationFragments.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/VersionTuple.h"
@@ -331,6 +332,12 @@
   Names["title"] = Record.Name;
   serializeArray(Names, "subHeading",
                  serializeDeclarationFragments(Record.SubHeading));
+  DeclarationFragments NavigatorFragments;
+  NavigatorFragments.append(Record.Name,
+                            DeclarationFragments::FragmentKind::Identifier,
+                            /*PreciseIdentifier*/ "");
+  serializeArray(Names, "navigator",
+                 serializeDeclarationFragments(NavigatorFragments));
 
   return Names;
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to