clang: lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
19#include "llvm/ADT/STLExtras.h"
20#include "llvm/ADT/STLFunctionalExtras.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/Support/Compiler.h"
23#include "llvm/Support/Path.h"
24#include "llvm/Support/VersionTuple.h"
25#include "llvm/Support/raw_ostream.h"
26#include
27#include
28
29using namespace clang;
31using namespace llvm;
32
33namespace {
34
35
36
37void serializeObject(Object &Paren, StringRef Key,
38 std::optional &&Obj) {
39 if (Obj)
40 Paren[Key] = std::move(*Obj);
41}
42
43
44
45void serializeArray(Object &Paren, StringRef Key,
46 std::optional &&Array) {
47 if (Array)
48 Paren[Key] = std::move(*Array);
49}
50
51
52
53template
54void serializeArray(Object &Paren, StringRef Key, ContainerTy &&C) {
56}
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74std::optional serializeSemanticVersion(const VersionTuple &V) {
75 if (V.empty())
76 return std::nullopt;
77
79 Version["major"] = V.getMajor();
80 Version["minor"] = V.getMinor().value_or(0);
81 Version["patch"] = V.getSubminor().value_or(0);
82 return Version;
83}
84
85
86
87
88
89Object serializeOperatingSystem(const Triple &T) {
91 OS["name"] = T.getOSTypeName(T.getOS());
92 serializeObject(OS, "minimumVersion",
93 serializeSemanticVersion(T.getMinimumSupportedOSVersion()));
94 return OS;
95}
96
97
98
99
100
101Object serializePlatform(const Triple &T) {
103 Platform["architecture"] = T.getArchName();
104 Platform["vendor"] = T.getVendorName();
105
106 if (.getEnvironmentName().empty())
107 Platform["environment"] = T.getEnvironmentName();
108
109 Platform["operatingSystem"] = serializeOperatingSystem(T);
110 return Platform;
111}
112
113
115 assert(Loc.isValid() && "invalid source position");
116
117 Object SourcePosition;
118 SourcePosition["line"] = Loc.getLine() - 1;
119 SourcePosition["character"] = Loc.getColumn() - 1;
120
121 return SourcePosition;
122}
123
124
125
126
127
128
130 bool IncludeFileURI = false) {
132 serializeObject(SourceLocation, "position", serializeSourcePosition(Loc));
133
134 if (IncludeFileURI) {
135 std::string FileURI = "file://";
136
137 FileURI += sys::path::convert_to_slash(Loc.getFilename());
139 }
140
142}
143
144
148 serializeObject(SourceRange, "start", serializeSourcePosition(BeginLoc));
149 serializeObject(SourceRange, "end", serializeSourcePosition(EndLoc));
151}
152
153
154
155
156
157
158
159
160
161
162
163
164std::optional serializeAvailability(const AvailabilityInfo &Avail) {
166 return std::nullopt;
167
168 Array AvailabilityArray;
169
171 Object UnconditionallyDeprecated;
172 UnconditionallyDeprecated["domain"] = "*";
173 UnconditionallyDeprecated["isUnconditionallyDeprecated"] = true;
174 AvailabilityArray.emplace_back(std::move(UnconditionallyDeprecated));
175 }
176
177 if (Avail.Domain.str() != "") {
179 Availability["domain"] = Avail.Domain;
180
182 Availability["isUnconditionallyUnavailable"] = true;
183 } else {
184 serializeObject(Availability, "introduced",
185 serializeSemanticVersion(Avail.Introduced));
186 serializeObject(Availability, "deprecated",
187 serializeSemanticVersion(Avail.Deprecated));
188 serializeObject(Availability, "obsoleted",
189 serializeSemanticVersion(Avail.Obsoleted));
190 }
191
192 AvailabilityArray.emplace_back(std::move(Availability));
193 }
194
195 return AvailabilityArray;
196}
197
198
200 switch (Lang) {
202 return "c";
204 return "objective-c";
206 return "c++";
208 return "objective-c++";
209
210
216
217
222 llvm_unreachable("Unsupported language kind");
223 }
224
225 llvm_unreachable("Unhandled language kind");
226}
227
228
229
230
231
234 Identifier["precise"] = Record.USR;
236
237 return Identifier;
238}
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256std::optional serializeDocComment(const DocComment &Comment) {
257 if (Comment.empty())
258 return std::nullopt;
259
261
262 Array LinesArray;
263 for (const auto &CommentLine : Comment) {
265 Line["text"] = CommentLine.Text;
266 serializeObject(Line, "range",
267 serializeSourceRange(CommentLine.Begin, CommentLine.End));
268 LinesArray.emplace_back(std::move(Line));
269 }
270
271 serializeArray(DocComment, "lines", std::move(LinesArray));
272
274}
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310std::optional
313 return std::nullopt;
314
315 Array Fragments;
318 Fragment["spelling"] = F.Spelling;
320 if (!F.PreciseIdentifier.empty())
321 Fragment["preciseIdentifier"] = F.PreciseIdentifier;
322 Fragments.emplace_back(std::move(Fragment));
323 }
324
325 return Fragments;
326}
327
328
329
330
331
332
333
334
335
336
339 Names["title"] = Record->Name;
340
341 serializeArray(Names, "subHeading",
342 serializeDeclarationFragments(Record->SubHeading));
344
345
346
347 switch (Record->getKind()) {
350 "");
351 break;
354 "");
355 break;
356 default:
357 break;
358 }
359
362 "");
363 serializeArray(Names, "navigator",
364 serializeDeclarationFragments(NavigatorFragments));
365
366 return Names;
367}
368
370 auto AddLangPrefix = [&Lang](StringRef S) -> std::string {
372 };
373
375 switch (RK) {
377 Kind["identifier"] = AddLangPrefix("unknown");
378 Kind["displayName"] = "Unknown";
379 break;
381 Kind["identifier"] = AddLangPrefix("namespace");
382 Kind["displayName"] = "Namespace";
383 break;
385 Kind["identifier"] = AddLangPrefix("func");
386 Kind["displayName"] = "Function";
387 break;
389 Kind["identifier"] = AddLangPrefix("func");
390 Kind["displayName"] = "Function Template";
391 break;
393 Kind["identifier"] = AddLangPrefix("func");
394 Kind["displayName"] = "Function Template Specialization";
395 break;
397 Kind["identifier"] = AddLangPrefix("var");
398 Kind["displayName"] = "Global Variable Template";
399 break;
401 Kind["identifier"] = AddLangPrefix("var");
402 Kind["displayName"] = "Global Variable Template Specialization";
403 break;
405 Kind["identifier"] = AddLangPrefix("var");
406 Kind["displayName"] = "Global Variable Template Partial Specialization";
407 break;
409 Kind["identifier"] = AddLangPrefix("var");
410 Kind["displayName"] = "Global Variable";
411 break;
413 Kind["identifier"] = AddLangPrefix("enum.case");
414 Kind["displayName"] = "Enumeration Case";
415 break;
417 Kind["identifier"] = AddLangPrefix("enum");
418 Kind["displayName"] = "Enumeration";
419 break;
421 Kind["identifier"] = AddLangPrefix("property");
422 Kind["displayName"] = "Instance Property";
423 break;
425 Kind["identifier"] = AddLangPrefix("struct");
426 Kind["displayName"] = "Structure";
427 break;
429 Kind["identifier"] = AddLangPrefix("property");
430 Kind["displayName"] = "Instance Property";
431 break;
433 Kind["identifier"] = AddLangPrefix("union");
434 Kind["displayName"] = "Union";
435 break;
437 Kind["identifier"] = AddLangPrefix("property");
438 Kind["displayName"] = "Instance Property";
439 break;
441 Kind["identifier"] = AddLangPrefix("type.property");
442 Kind["displayName"] = "Type Property";
443 break;
448 Kind["identifier"] = AddLangPrefix("class");
449 Kind["displayName"] = "Class";
450 break;
452 Kind["identifier"] = AddLangPrefix("method");
453 Kind["displayName"] = "Method Template";
454 break;
456 Kind["identifier"] = AddLangPrefix("method");
457 Kind["displayName"] = "Method Template Specialization";
458 break;
460 Kind["identifier"] = AddLangPrefix("property");
461 Kind["displayName"] = "Template Property";
462 break;
464 Kind["identifier"] = AddLangPrefix("concept");
465 Kind["displayName"] = "Concept";
466 break;
468 Kind["identifier"] = AddLangPrefix("type.method");
469 Kind["displayName"] = "Static Method";
470 break;
472 Kind["identifier"] = AddLangPrefix("method");
473 Kind["displayName"] = "Instance Method";
474 break;
476 Kind["identifier"] = AddLangPrefix("method");
477 Kind["displayName"] = "Constructor";
478 break;
480 Kind["identifier"] = AddLangPrefix("method");
481 Kind["displayName"] = "Destructor";
482 break;
484 Kind["identifier"] = AddLangPrefix("ivar");
485 Kind["displayName"] = "Instance Variable";
486 break;
488 Kind["identifier"] = AddLangPrefix("method");
489 Kind["displayName"] = "Instance Method";
490 break;
492 Kind["identifier"] = AddLangPrefix("type.method");
493 Kind["displayName"] = "Type Method";
494 break;
496 Kind["identifier"] = AddLangPrefix("property");
497 Kind["displayName"] = "Instance Property";
498 break;
500 Kind["identifier"] = AddLangPrefix("type.property");
501 Kind["displayName"] = "Type Property";
502 break;
504 Kind["identifier"] = AddLangPrefix("class");
505 Kind["displayName"] = "Class";
506 break;
508 Kind["identifier"] = AddLangPrefix("class.extension");
509 Kind["displayName"] = "Class Extension";
510 break;
512 Kind["identifier"] = AddLangPrefix("protocol");
513 Kind["displayName"] = "Protocol";
514 break;
516 Kind["identifier"] = AddLangPrefix("macro");
517 Kind["displayName"] = "Macro";
518 break;
520 Kind["identifier"] = AddLangPrefix("typealias");
521 Kind["displayName"] = "Type Alias";
522 break;
523 default:
524 llvm_unreachable("API Record with uninstantiable kind");
525 }
526
527 return Kind;
528}
529
530
531
532
533
534
536 return serializeSymbolKind(Record.KindForDisplay, Lang);
537}
538
539
540
541
542
543
544
545
546template
547void serializeFunctionSignatureMixin(Object &Paren, const RecordTy &Record) {
548 const auto &FS = Record.Signature;
549 if (FS.empty())
550 return;
551
553 serializeArray(Signature, "returns",
554 serializeDeclarationFragments(FS.getReturnType()));
555
557 for (const auto &P : FS.getParameters()) {
560 serializeArray(Parameter, "declarationFragments",
561 serializeDeclarationFragments(P.Fragments));
563 }
564
566 Signature["parameters"] = std::move(Parameters);
567
568 serializeObject(Paren, "functionSignature", std::move(Signature));
569}
570
571template
572void serializeTemplateMixin(Object &Paren, const RecordTy &Record) {
575 return;
576
578 Array GenericParameters;
582 Parameter["index"] = Param.Index;
583 Parameter["depth"] = Param.Depth;
584 GenericParameters.emplace_back(std::move(Parameter));
585 }
586 if (!GenericParameters.empty())
587 Generics["parameters"] = std::move(GenericParameters);
588
589 Array GenericConstraints;
592 Constraint["kind"] = Constr.Kind;
593 Constraint["lhs"] = Constr.LHS;
594 Constraint["rhs"] = Constr.RHS;
595 GenericConstraints.emplace_back(std::move(Constraint));
596 }
597
598 if (!GenericConstraints.empty())
599 Generics["constraints"] = std::move(GenericConstraints);
600
601 serializeObject(Paren, "swiftGenerics", Generics);
602}
603
606 Array ParentContexts;
607
608 for (const auto &Parent : Parents) {
610 Elem["usr"] = Parent.USR;
611 Elem["name"] = Parent.Name;
612 if (Parent.Record)
613 Elem["kind"] = serializeSymbolKind(Parent.Record->KindForDisplay,
614 Lang)["identifier"];
615 else
616 Elem["kind"] =
618 ParentContexts.emplace_back(std::move(Elem));
619 }
620
621 return ParentContexts;
622}
623
624
625
629 for (const auto *Current = Record; Current != nullptr;
630 Current = Current->Parent.Record)
631 ReverseHierarchy.emplace_back(Current);
632
634 std::make_move_iterator(ReverseHierarchy.rbegin()),
635 std::make_move_iterator(ReverseHierarchy.rend()));
636}
637
640
641
642 if (auto *CategoryRecord = dyn_cast_or_null(Record)) {
643 return CategoryRecord->Interface;
644
645
646 }
647
649}
650
651}
652
654 Symbols.emplace_back(std::move(Symbol));
655 return Symbols.back().getAsObject();
656}
657
661
662
663const VersionTuple SymbolGraphSerializer::FormatVersion{0, 5, 3};
664
665Object SymbolGraphSerializer::serializeMetadata() const {
666 Object Metadata;
667 serializeObject(Metadata, "formatVersion",
668 serializeSemanticVersion(FormatVersion));
670 return Metadata;
671}
672
673Object
674SymbolGraphSerializer::serializeModuleObject(StringRef ModuleName) const {
676 Module["name"] = ModuleName;
677 serializeObject(Module, "platform", serializePlatform(API.getTarget()));
679}
680
681bool SymbolGraphSerializer::shouldSkip(const APIRecord *Record) const {
683 return true;
684
685
686 if (Record->Availability.isUnconditionallyUnavailable())
687 return true;
688
689
690
691 if (Record->Name.starts_with("_"))
692 return true;
693
694
695 if (IgnoresList.shouldIgnore(Record->Name))
696 return true;
697
698 return false;
699}
700
701ExtendedModule &SymbolGraphSerializer::getModuleForCurrentSymbol() {
702 if (!ForceEmitToMainModule && ModuleForCurrentSymbol)
703 return *ModuleForCurrentSymbol;
704
705 return MainModule;
706}
707
708Array SymbolGraphSerializer::serializePathComponents(
710 return Array(map_range(Hierarchy, [](auto Elt) { return Elt.Name; }));
711}
712
713StringRef SymbolGraphSerializer::getRelationshipString(RelationshipKind Kind) {
714 switch (Kind) {
715 case RelationshipKind::MemberOf:
716 return "memberOf";
717 case RelationshipKind::InheritsFrom:
718 return "inheritsFrom";
719 case RelationshipKind::ConformsTo:
720 return "conformsTo";
721 case RelationshipKind::ExtensionTo:
722 return "extensionTo";
723 }
724 llvm_unreachable("Unhandled relationship kind");
725}
726
727void SymbolGraphSerializer::serializeRelationship(RelationshipKind Kind,
732 SmallString<64> TestRelLabel;
733 if (EmitSymbolLabelsForTesting) {
734 llvm::raw_svector_ostream OS(TestRelLabel);
735 OS << SymbolGraphSerializer::getRelationshipString(Kind) << " $ "
736 << Source.USR << " $ ";
737 if (Target.USR.empty())
739 else
741 Relationship["!testRelLabel"] = TestRelLabel;
742 }
743 Relationship["source"] = Source.USR;
744 Relationship["target"] = Target.USR;
745 Relationship["targetFallback"] = Target.Name;
746 Relationship["kind"] = SymbolGraphSerializer::getRelationshipString(Kind);
747
748 if (ForceEmitToMainModule)
749 MainModule.addRelationship(std::move(Relationship));
750 else
752}
753
754StringRef SymbolGraphSerializer::getConstraintString(ConstraintKind Kind) {
755 switch (Kind) {
756 case ConstraintKind::Conformance:
757 return "conformance";
758 case ConstraintKind::ConditionalConformance:
759 return "conditionalConformance";
760 }
761 llvm_unreachable("Unhandled constraint kind");
762}
763
764void SymbolGraphSerializer::serializeAPIRecord(const APIRecord *Record) {
766
767
768
769 if (EmitSymbolLabelsForTesting)
770 Obj["!testLabel"] = Record->USR;
771
772 serializeObject(Obj, "identifier",
773 serializeIdentifier(*Record, API.getLanguage()));
774 serializeObject(Obj, "kind", serializeSymbolKind(*Record, API.getLanguage()));
775 serializeObject(Obj, "names", serializeNames(Record));
776 serializeObject(
777 Obj, "location",
778 serializeSourceLocation(Record->Location, true));
779 serializeArray(Obj, "availability",
780 serializeAvailability(Record->Availability));
781 serializeObject(Obj, "docComment", serializeDocComment(Record->Comment));
782 serializeArray(Obj, "declarationFragments",
783 serializeDeclarationFragments(Record->Declaration));
784
785 Obj["pathComponents"] = serializePathComponents(Record);
786 Obj["accessLevel"] = Record->Access.getAccess();
787
788 ExtendedModule &Module = getModuleForCurrentSymbol();
789
790 if (Hierarchy.size() >= 2)
791 serializeRelationship(MemberOf, Hierarchy.back(),
792 Hierarchy[Hierarchy.size() - 2], Module);
793
794 CurrentSymbol = Module.addSymbol(std::move(Obj));
795}
796
799 return true;
800 if (shouldSkip(Record))
801 return true;
802 Hierarchy.push_back(getHierarchyReference(Record, API));
803
805 Hierarchy.pop_back();
806 return RetVal;
807}
808
810 serializeAPIRecord(Record);
811 return true;
812}
813
816 if (!CurrentSymbol)
817 return true;
818
819 serializeFunctionSignatureMixin(*CurrentSymbol, *Record);
820 return true;
821}
822
824 if (!CurrentSymbol)
825 return true;
826
827 for (const auto &Base : Record->Bases)
828 serializeRelationship(RelationshipKind::InheritsFrom, Record, Base,
829 getModuleForCurrentSymbol());
830 return true;
831}
832
835 if (!CurrentSymbol)
836 return true;
837
838 serializeTemplateMixin(*CurrentSymbol, *Record);
839 return true;
840}
841
844 if (!CurrentSymbol)
845 return true;
846
847 serializeTemplateMixin(*CurrentSymbol, *Record);
848 return true;
849}
850
853 if (!CurrentSymbol)
854 return true;
855
856 serializeFunctionSignatureMixin(*CurrentSymbol, *Record);
857 return true;
858}
859
862 if (!CurrentSymbol)
863 return true;
864
865 serializeTemplateMixin(*CurrentSymbol, *Record);
866 return true;
867}
868
871 if (!CurrentSymbol)
872 return true;
873
874 serializeTemplateMixin(*CurrentSymbol, *Record);
875 return true;
876}
877
879 if (!CurrentSymbol)
880 return true;
881
882 serializeTemplateMixin(*CurrentSymbol, *Record);
883 return true;
884}
885
888 if (!CurrentSymbol)
889 return true;
890
891 serializeTemplateMixin(*CurrentSymbol, *Record);
892 return true;
893}
894
898 if (!CurrentSymbol)
899 return true;
900
901 serializeTemplateMixin(*CurrentSymbol, *Record);
902 return true;
903}
904
907 if (!CurrentSymbol)
908 return true;
909
910 serializeTemplateMixin(*CurrentSymbol, *Record);
911 return true;
912}
913
916 if (!CurrentSymbol)
917 return true;
918
919 for (const auto &Protocol : Record->Protocols)
920 serializeRelationship(ConformsTo, Record, Protocol,
921 getModuleForCurrentSymbol());
922
923 return true;
924}
925
928 if (!CurrentSymbol)
929 return true;
930
931 if (->SuperClass.empty())
932 serializeRelationship(InheritsFrom, Record, Record->SuperClass,
933 getModuleForCurrentSymbol());
934 return true;
935}
936
939 if (SkipSymbolsInCategoriesToExternalTypes &&
940 .findRecordForUSR(Record->Interface.USR))
941 return true;
942
943 auto *CurrentModule = ModuleForCurrentSymbol;
944 if (auto ModuleExtendedByRecord = Record->getExtendedExternalModule())
945 ModuleForCurrentSymbol = &ExtendedModules[*ModuleExtendedByRecord];
946
948 return false;
949
950 bool RetVal = traverseRecordContext(Record);
951 ModuleForCurrentSymbol = CurrentModule;
952 return RetVal;
953}
954
959
962
963
964
965 for (const auto &Protocol : Record->Protocols)
966 serializeRelationship(ConformsTo, Record->Interface, Protocol,
967 getModuleForCurrentSymbol());
968
969 return true;
970}
971
974 if (!CurrentSymbol)
975 return true;
976
977 serializeFunctionSignatureMixin(*CurrentSymbol, *Record);
978 return true;
979}
980
983
984 return true;
985}
986
994
996
997
998 bool ShouldDrop = Record->UnderlyingType.Name.empty();
999
1000
1001 ShouldDrop |= (Record->UnderlyingType.Name == Record->Name);
1002 if (ShouldDrop)
1003 return true;
1004
1005
1006 serializeAPIRecord(Record);
1007 if (!CurrentSymbol)
1008 return true;
1009
1010 (*CurrentSymbol)["type"] = Record->UnderlyingType.USR;
1011
1012 return true;
1013}
1014
1015void SymbolGraphSerializer::serializeSingleRecord(const APIRecord *Record) {
1016 switch (Record->getKind()) {
1017
1018#define CONCRETE_RECORD(CLASS, BASE, KIND) \
1019 case APIRecord::KIND: { \
1020 walkUpFrom##CLASS(static_cast<const CLASS *>(Record)); \
1021 break; \
1022 }
1024
1027 break;
1028 default:
1029 llvm_unreachable("API Record with uninstantiable kind");
1030 }
1031}
1032
1033Object SymbolGraphSerializer::serializeGraph(StringRef ModuleName,
1035 Object Root;
1036 serializeObject(Root, "metadata", serializeMetadata());
1037 serializeObject(Root, "module", serializeModuleObject(ModuleName));
1038
1039 Root["symbols"] = std::move(EM.Symbols);
1040 Root["relationships"] = std::move(EM.Relationships);
1041
1042 return Root;
1043}
1044
1045void SymbolGraphSerializer::serializeGraphToStream(
1048 Object Root = serializeGraph(ModuleName, std::move(EM));
1050 OS << formatv("{0}", json::Value(std::move(Root))) << "\n";
1051 else
1052 OS << formatv("{0:2}", json::Value(std::move(Root))) << "\n";
1053}
1054
1060 true,
1061 true);
1062
1064 Serializer.serializeGraphToStream(OS, Options, API.ProductName,
1065 std::move(Serializer.MainModule));
1066
1067}
1068
1070 raw_ostream &MainOutput, const APISet &API,
1072 llvm::function_ref<std::unique_ptrllvm::raw\_pwrite\_stream(Twine BaseName)>
1073 CreateOutputStream,
1078
1079 Serializer.serializeGraphToStream(MainOutput, Options, API.ProductName,
1080 std::move(Serializer.MainModule));
1081
1082 for (auto &ExtensionSGF : Serializer.ExtendedModules) {
1083 if (auto ExtensionOS =
1084 CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
1085 Serializer.serializeGraphToStream(*ExtensionOS, Options, API.ProductName,
1086 std::move(ExtensionSGF.getValue()));
1087 }
1088}
1089
1090std::optional
1095 return {};
1096
1097 Object Root;
1100 false,
1101 true);
1102
1103
1104 Serializer.Hierarchy = generateHierarchyFromRecord(Record);
1105
1106 Serializer.serializeSingleRecord(Record);
1107 serializeObject(Root, "symbolGraph",
1108 Serializer.serializeGraph(API.ProductName,
1109 std::move(Serializer.MainModule)));
1110
1112 serializeArray(Root, "parentContexts",
1113 generateParentContexts(Serializer.Hierarchy, Lang));
1114
1115 Array RelatedSymbols;
1116
1117 for (const auto &Fragment : Record->Declaration.getFragments()) {
1118
1119 if (Fragment.PreciseIdentifier.empty())
1120 continue;
1121
1122 APIRecord *RelatedRecord = API.findRecordForUSR(Fragment.PreciseIdentifier);
1123
1124
1125 if (!RelatedRecord)
1126 continue;
1127
1128 Object RelatedSymbol;
1129 RelatedSymbol["usr"] = RelatedRecord->USR;
1130 RelatedSymbol["declarationLanguage"] = getLanguageName(Lang);
1131 RelatedSymbol["accessLevel"] = RelatedRecord->Access.getAccess();
1133 RelatedSymbol["moduleName"] = API.ProductName;
1135
1136 serializeArray(RelatedSymbol, "parentContexts",
1137 generateParentContexts(
1138 generateHierarchyFromRecord(RelatedRecord), Lang));
1139
1140 RelatedSymbols.push_back(std::move(RelatedSymbol));
1141 }
1142
1143 serializeArray(Root, "relatedSymbols", RelatedSymbols);
1144 return Root;
1145}
This file defines the classes defined from ExtractAPI's APIRecord.
This file defines the APIRecord-based structs and the APISet class.
This file defines the Declaration Fragments related classes.
StringRef getLanguageName(FormatStyle::LanguageKind Language)
llvm::MachO::Record Record
Defines the clang::SourceLocation class and associated facilities.
This file defines the SymbolGraphSerializer class.
Defines version macros and version-related utility functions for Clang.
Describes a module or submodule.
Represents an unpacked "presumed" location which can be presented to the user.
unsigned getColumn() const
Return the presumed column number of this location.
const char * getFilename() const
Return the presumed filename of this location.
unsigned getLine() const
Return the presumed line number of this location.
Encodes a location in the source.
A trivial tuple used to represent a source range.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
The JSON file list parser is used to communicate input to InstallAPI.
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
Language
The language for the input, used to select and validate the language standard and possible actions.
@ C
Languages that the frontend can parse and compile.
@ CIR
LLVM IR & CIR: we accept these so that we can run the optimizer on them, and compile them to assembly...
@ Asm
Assembly: we accept this only so that we can preprocess it.
@ Parameter
The parameter type of a method or function.
const FunctionProtoType * T
std::string getClangFullVersion()
Retrieves a string representing the complete clang version, which includes the clang version number,...
Diagnostic wrappers for TextAPI types for error reporting.
Storage of availability attributes for a declaration.
bool isUnconditionallyDeprecated() const
Check if the symbol is unconditionally deprecated.
llvm::SmallString< 32 > Domain
The domain is the platform for which this availability info applies to.
bool isDefault() const
Determine if this AvailabilityInfo represents the default availability.
bool isUnavailable() const
Check if the symbol is unavailable unconditionally or on the active platform and os version.