Lines Matching +full:string +full:- +full:array +full:- +full:property

1 //===- ExtractAPI/Serialization/SymbolGraphSerializer.cpp -------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
45 /// Helper function to inject a JSON array \p Array into object \p Paren at
48 std::optional<Array> &&Array) {
49 if (Array)
50 Paren[Key] = std::move(*Array);
53 /// Helper function to inject a JSON array composed of the values in \p C into
57 Paren[Key] = Array(C);
87 /// Serialize the OS information in the Symbol Graph platform property.
116 SourcePosition["line"] = Loc.getLine() - 1;
117 SourcePosition["character"] = Loc.getColumn() - 1;
133 std::string FileURI = "file://";
160 /// or an \c Array containing an object with the formatted availability
162 std::optional<Array> serializeAvailability(const AvailabilityInfo &Avail) {
166 Array AvailabilityArray;
193 /// Get the language name string for interface language references.
199 return "objective-c";
203 return "objective-c++";
226 /// The identifier property of a symbol contains the USR for precise and unique
239 /// The Symbol Graph \c docComment object contains an array of lines. Each line
258 Array LinesArray;
274 /// The Symbol Graph declaration fragments is an array of tagged important
277 /// purposes like syntax-highlighting etc. For example:
279 /// const int pi; -> "declarationFragments" : [
304 /// \returns \c std::nullopt if \p DF is empty, or an \c Array containing the
305 /// formatted declaration fragments array.
306 std::optional<Array>
311 Array Fragments;
329 /// - \c title : The simple declared name of the symbol;
330 /// - \c subHeading : An array of declaration fragments that provides tags,
331 /// and potentially more tokens (for example the \c +/- symbol for
332 /// Objective-C methods). Can be used as sub-headings for documentation.
335 Names["title"] = Record->Name;
338 serializeDeclarationFragments(Record->SubHeading));
340 NavigatorFragments.append(Record->Name,
350 auto AddLangPrefix = [&Lang](StringRef S) -> std::string {
401 Kind["identifier"] = AddLangPrefix("property");
402 Kind["displayName"] = "Instance Property";
409 Kind["identifier"] = AddLangPrefix("property");
410 Kind["displayName"] = "Instance Property";
417 Kind["identifier"] = AddLangPrefix("property");
418 Kind["displayName"] = "Instance Property";
421 Kind["identifier"] = AddLangPrefix("type.property");
422 Kind["displayName"] = "Type Property";
440 Kind["identifier"] = AddLangPrefix("property");
441 Kind["displayName"] = "Template Property";
476 Kind["identifier"] = AddLangPrefix("property");
477 Kind["displayName"] = "Instance Property";
480 Kind["identifier"] = AddLangPrefix("type.property");
481 Kind["displayName"] = "Type Property";
512 /// The Symbol Graph symbol kind property contains a shorthand \c identifier
514 /// the kind, and a \c displayName for rendering human-readable names.
522 /// The Symbol Graph function signature property contains two arrays.
523 /// - The \c returns array is the declaration fragments of the return type;
524 /// - The \c parameters array contains names and declaration fragments of the
536 Array Parameters;
558 Array GenericParameters;
569 Array GenericConstraints;
584 Array generateParentContexts(const SmallVectorImpl<SymbolReference> &Parents,
586 Array ParentContexts;
593 Elem["kind"] = serializeSymbolKind(Parent.Record->KindForDisplay,
610 Current = Current->Parent.Record)
623 return CategoryRecord->Interface;
666 if (Record->Availability.isUnconditionallyUnavailable())
673 if (Tag->IsEmbeddedInVarDeclarator)
679 if (Record->Name.starts_with("_"))
683 if (IgnoresList.shouldIgnore(Record->Name))
696 Array SymbolGraphSerializer::serializePathComponents(
698 return Array(map_range(Hierarchy, [](auto Elt) { return Elt.Name; }));
758 Obj["!testLabel"] = Record->USR;
766 serializeSourceLocation(Record->Location, /*IncludeFileURI=*/true));
768 serializeAvailability(Record->Availability));
769 serializeObject(Obj, "docComment", serializeDocComment(Record->Comment));
771 serializeDeclarationFragments(Record->Declaration));
774 Obj["accessLevel"] = Record->Access.getAccess();
780 Hierarchy[Hierarchy.size() - 2], Module);
815 for (const auto &Base : Record->Bases)
907 for (const auto &Protocol : Record->Protocols)
919 if (!Record->SuperClass.empty())
920 serializeRelationship(InheritsFrom, Record, Record->SuperClass,
928 !API.findRecordForUSR(Record->Interface.USR))
932 if (Record->isExtendingExternalModule())
933 ModuleForCurrentSymbol = &ExtendedModules[Record->Interface.Source];
953 for (const auto &Protocol : Record->Protocols)
954 serializeRelationship(ConformsTo, Record->Interface, Protocol,
977 // Short-circuit walking up the class hierarchy and handle creating typedef
986 bool ShouldDrop = Record->UnderlyingType.Name.empty();
989 ShouldDrop |= (Record->UnderlyingType.Name == Record->Name);
998 (*CurrentSymbol)["type"] = Record->UnderlyingType.USR;
1004 switch (Record->getKind()) {
1104 Array RelatedSymbols;
1106 for (const auto &Fragment : Record->Declaration.getFragments()) {
1118 RelatedSymbol["usr"] = RelatedRecord->USR;
1120 RelatedSymbol["accessLevel"] = RelatedRecord->Access.getAccess();
1121 RelatedSymbol["filePath"] = RelatedRecord->Location.getFilename();
1123 RelatedSymbol["isSystem"] = RelatedRecord->IsFromSystemHeader;