clang-tools 24.0.0git
YAMLSerialization.cpp
Go to the documentation of this file.
1//===-- YAMLSerialization.cpp ------------------------------------*- C++-*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// A YAML index file is a sequence of tagged entries.
10// Each entry either encodes a Symbol or the list of references to a symbol
11// (a "ref bundle").
12//
13//===----------------------------------------------------------------------===//
14
15#include "Headers.h"
16#include "index/Ref.h"
17#include "index/Relation.h"
18#include "index/Serialization.h"
19#include "index/Symbol.h"
21#include "index/SymbolOrigin.h"
22#include "clang/Tooling/CompilationDatabase.h"
23#include "llvm/ADT/StringRef.h"
24#include "llvm/Support/Allocator.h"
25#include "llvm/Support/StringSaver.h"
26#include "llvm/Support/YAMLTraits.h"
27#include "llvm/Support/raw_ostream.h"
28#include <cstdint>
29#include <optional>
30
31namespace {
32struct YIncludeHeaderWithReferences;
33}
34
36LLVM_YAML_IS_SEQUENCE_VECTOR(clang::clangd::Ref)
37LLVM_YAML_IS_SEQUENCE_VECTOR(YIncludeHeaderWithReferences)
38
39namespace {
40using RefBundle =
41 std::pair<clang::clangd::SymbolID, std::vector<clang::clangd::Ref>>;
42// This is a pale imitation of std::variant<Symbol, RefBundle, Relation>
43struct VariantEntry {
44 std::optional<clang::clangd::Symbol> Symbol;
45 std::optional<RefBundle> Refs;
46 std::optional<clang::clangd::Relation> Relation;
47 std::optional<clang::clangd::IncludeGraphNode> Source;
48 std::optional<clang::tooling::CompileCommand> Cmd;
49};
50// A class helps YAML to serialize the 32-bit encoded position (Line&Column),
51// as YAMLIO can't directly map bitfields.
52struct YPosition {
53 uint32_t Line;
54 uint32_t Column;
55};
56// A class helps YAML to serialize the IncludeHeaderWithReferences as YAMLIO
57// can't directly map bitfields.
58struct YIncludeHeaderWithReferences {
59 llvm::StringRef IncludeHeader;
60 uint32_t References;
62
63 YIncludeHeaderWithReferences() = default;
64
65 YIncludeHeaderWithReferences(
66 llvm::StringRef IncludeHeader, uint32_t References,
68 : IncludeHeader(IncludeHeader), References(References),
69 SupportedDirectives(SupportedDirectives) {}
70};
71
72// avoid ODR violation of specialization for non-owned CompileCommand
73struct CompileCommandYAML : clang::tooling::CompileCommand {};
74
75} // namespace
76namespace llvm {
77namespace yaml {
78
81using clang::clangd::IncludeGraphNode;
82using clang::clangd::Ref;
84using clang::clangd::Relation;
86using clang::clangd::Symbol;
87using clang::clangd::SymbolID;
88using clang::clangd::SymbolLocation;
89using clang::index::SymbolInfo;
90using clang::index::SymbolKind;
91using clang::index::SymbolLanguage;
92using clang::tooling::CompileCommand;
93
94// Helper to (de)serialize the SymbolID. We serialize it as a hex string.
97 NormalizedSymbolID(IO &, const SymbolID &ID) {
98 llvm::raw_string_ostream OS(HexString);
99 OS << ID;
100 }
101
103 auto ID = SymbolID::fromStr(HexString);
104 if (!ID) {
105 I.setError(llvm::toString(ID.takeError()));
106 return SymbolID();
107 }
108 return *ID;
109 }
110
111 std::string HexString;
112};
113
117 Flag = static_cast<uint8_t>(F);
118 }
119
121 return static_cast<Symbol::SymbolFlag>(Flag);
122 }
123
124 uint8_t Flag = 0;
125};
126
127template <> struct MappingTraits<YPosition> {
128 static void mapping(IO &IO, YPosition &Value) {
129 IO.mapRequired("Line", Value.Line);
130 IO.mapRequired("Column", Value.Column);
131 }
132};
133
137 NormalizedPosition(IO &, const Position &Pos) {
138 P.Line = Pos.line();
139 P.Column = Pos.column();
140 }
141
143 Position Pos;
144 Pos.setLine(P.Line);
145 Pos.setColumn(P.Column);
146 return Pos;
147 }
148 YPosition P;
149};
150
153 NormalizedFileURI(IO &, const char *FileURI) { URI = FileURI; }
154
155 const char *denormalize(IO &IO) {
156 assert(IO.getContext() &&
157 "Expecting an UniqueStringSaver to allocate data");
158 return static_cast<llvm::UniqueStringSaver *>(IO.getContext())
159 ->save(URI)
160 .data();
161 }
162
163 std::string URI;
164};
165
166template <> struct MappingTraits<SymbolLocation> {
167 static void mapping(IO &IO, SymbolLocation &Value) {
168 MappingNormalization<NormalizedFileURI, const char *> NFile(IO,
169 Value.FileURI);
170 IO.mapRequired("FileURI", NFile->URI);
171 MappingNormalization<NormalizedPosition, SymbolLocation::Position> NStart(
172 IO, Value.Start);
173 IO.mapRequired("Start", NStart->P);
174 MappingNormalization<NormalizedPosition, SymbolLocation::Position> NEnd(
175 IO, Value.End);
176 IO.mapRequired("End", NEnd->P);
177 }
178};
179
180template <> struct MappingTraits<SymbolInfo> {
181 static void mapping(IO &IO, SymbolInfo &SymInfo) {
182 // FIXME: expose other fields?
183 IO.mapRequired("Kind", SymInfo.Kind);
184 IO.mapRequired("Lang", SymInfo.Lang);
185 }
186};
187
188template <> struct ScalarBitSetTraits<clang::clangd::Symbol::IncludeDirective> {
190 IO.bitSetCase(Value, "Include", clang::clangd::Symbol::Include);
191 IO.bitSetCase(Value, "Import", clang::clangd::Symbol::Import);
192 }
193};
194
195template <> struct MappingTraits<YIncludeHeaderWithReferences> {
196 static void mapping(IO &IO, YIncludeHeaderWithReferences &Inc) {
197 IO.mapRequired("Header", Inc.IncludeHeader);
198 IO.mapRequired("References", Inc.References);
199 IO.mapOptional("Directives", Inc.SupportedDirectives,
201 }
202};
203
208 IO &, const llvm::SmallVector<IncludeHeader, 1> &IncludeHeaders) {
209 for (auto &I : IncludeHeaders) {
210 Headers.emplace_back(I.IncludeHeader, I.References,
211 I.supportedDirectives());
212 }
213 }
214
215 llvm::SmallVector<IncludeHeader, 1> denormalize(IO &) {
216 llvm::SmallVector<IncludeHeader, 1> Result;
217 for (auto &H : Headers)
218 Result.emplace_back(H.IncludeHeader, H.References, H.SupportedDirectives);
219 return Result;
220 }
221 llvm::SmallVector<YIncludeHeaderWithReferences, 1> Headers;
222};
223
224template <> struct MappingTraits<Symbol> {
225 static void mapping(IO &IO, Symbol &Sym) {
226 MappingNormalization<NormalizedSymbolID, SymbolID> NSymbolID(IO, Sym.ID);
227 MappingNormalization<NormalizedSymbolFlag, Symbol::SymbolFlag> NSymbolFlag(
228 IO, Sym.Flags);
229 MappingNormalization<
231 llvm::SmallVector<Symbol::IncludeHeaderWithReferences, 1>>
232 NIncludeHeaders(IO, Sym.IncludeHeaders);
233 IO.mapRequired("ID", NSymbolID->HexString);
234 IO.mapRequired("Name", Sym.Name);
235 IO.mapRequired("Scope", Sym.Scope);
236 IO.mapRequired("SymInfo", Sym.SymInfo);
237 IO.mapOptional("CanonicalDeclaration", Sym.CanonicalDeclaration,
239 IO.mapOptional("Definition", Sym.Definition, SymbolLocation());
240 IO.mapOptional("References", Sym.References, 0u);
241 IO.mapOptional("Flags", NSymbolFlag->Flag);
242 IO.mapOptional("Signature", Sym.Signature);
243 IO.mapOptional("TemplateSpecializationArgs",
245 IO.mapOptional("CompletionSnippetSuffix", Sym.CompletionSnippetSuffix);
246 IO.mapOptional("Documentation", Sym.Documentation);
247 IO.mapOptional("ReturnType", Sym.ReturnType);
248 IO.mapOptional("Type", Sym.Type);
249 IO.mapOptional("Tags", Sym.Tags);
250 IO.mapOptional("IncludeHeaders", NIncludeHeaders->Headers);
251 }
252};
253
254template <> struct ScalarEnumerationTraits<SymbolLanguage> {
255 static void enumeration(IO &IO, SymbolLanguage &Value) {
256 IO.enumCase(Value, "C", SymbolLanguage::C);
257 IO.enumCase(Value, "Cpp", SymbolLanguage::CXX);
258 IO.enumCase(Value, "ObjC", SymbolLanguage::ObjC);
259 IO.enumCase(Value, "Swift", SymbolLanguage::Swift);
260 }
261};
262
263template <> struct ScalarEnumerationTraits<SymbolKind> {
264 static void enumeration(IO &IO, SymbolKind &Value) {
265#define DEFINE_ENUM_FINAL(name) \
266 case SymbolKind::name: \
267 IO.enumCase(Value, #name, SymbolKind::name)
268#define DEFINE_ENUM(name) \
269 DEFINE_ENUM_FINAL(name); \
270 [[fallthrough]]
271
272 SymbolKind Start = SymbolKind::Unknown;
273 switch (Start) {
274 DEFINE_ENUM(Unknown);
275 DEFINE_ENUM(Module);
276 DEFINE_ENUM(Namespace);
277 DEFINE_ENUM(NamespaceAlias);
278 DEFINE_ENUM(Macro);
279 DEFINE_ENUM(IncludeDirective);
280 DEFINE_ENUM(Enum);
281 DEFINE_ENUM(Struct);
282 DEFINE_ENUM(Class);
283 DEFINE_ENUM(Protocol);
284 DEFINE_ENUM(Extension);
285 DEFINE_ENUM(Union);
286 DEFINE_ENUM(TypeAlias);
287 DEFINE_ENUM(Function);
288 DEFINE_ENUM(Variable);
289 DEFINE_ENUM(Field);
290 DEFINE_ENUM(EnumConstant);
291 DEFINE_ENUM(InstanceMethod);
292 DEFINE_ENUM(ClassMethod);
293 DEFINE_ENUM(StaticMethod);
294 DEFINE_ENUM(InstanceProperty);
295 DEFINE_ENUM(ClassProperty);
296 DEFINE_ENUM(StaticProperty);
297 DEFINE_ENUM(Constructor);
298 DEFINE_ENUM(Destructor);
299 DEFINE_ENUM(ConversionFunction);
300 DEFINE_ENUM(Parameter);
301 DEFINE_ENUM(Using);
302 DEFINE_ENUM(TemplateTypeParm);
303 DEFINE_ENUM(TemplateTemplateParm);
304 DEFINE_ENUM(NonTypeTemplateParm);
305 DEFINE_ENUM_FINAL(Concept);
306 }
307
308#undef DEFINE_ENUM
309#undef DEFINE_ENUM_FINAL
310 }
311};
312
313template <> struct MappingTraits<RefBundle> {
314 static void mapping(IO &IO, RefBundle &Refs) {
315 MappingNormalization<NormalizedSymbolID, SymbolID> NSymbolID(IO,
316 Refs.first);
317 IO.mapRequired("ID", NSymbolID->HexString);
318 IO.mapRequired("References", Refs.second);
319 }
320};
321
324 NormalizedRefKind(IO &, RefKind O) { Kind = static_cast<uint8_t>(O); }
325
326 RefKind denormalize(IO &) { return static_cast<RefKind>(Kind); }
327
328 uint8_t Kind = 0;
329};
330
331template <> struct MappingTraits<Ref> {
332 static void mapping(IO &IO, Ref &R) {
333 MappingNormalization<NormalizedRefKind, RefKind> NKind(IO, R.Kind);
334 IO.mapRequired("Kind", NKind->Kind);
335 IO.mapRequired("Location", R.Location);
336 IO.mapOptional("Container", R.Container);
337 }
338};
339
343 Kind = static_cast<uint8_t>(R);
344 }
345
346 RelationKind denormalize(IO &IO) { return static_cast<RelationKind>(Kind); }
347
348 uint8_t Kind = 0;
349};
350
351template <> struct MappingTraits<SymbolID> {
352 static void mapping(IO &IO, SymbolID &ID) {
353 MappingNormalization<NormalizedSymbolID, SymbolID> NSymbolID(IO, ID);
354 IO.mapRequired("ID", NSymbolID->HexString);
355 }
356};
357
358template <> struct MappingTraits<Relation> {
359 static void mapping(IO &IO, Relation &Relation) {
360 MappingNormalization<NormalizedSymbolRole, RelationKind> NRole(
361 IO, Relation.Predicate);
362 IO.mapRequired("Subject", Relation.Subject);
363 IO.mapRequired("Predicate", NRole->Kind);
364 IO.mapRequired("Object", Relation.Object);
365 }
366};
367
371 Flag = static_cast<uint8_t>(O);
372 }
373
377
378 uint8_t Flag = 0;
379};
380
383 NormalizedFileDigest(IO &, const FileDigest &Digest) {
384 HexString = llvm::toHex(Digest);
385 }
386
388 FileDigest Digest;
389 if (HexString.size() == Digest.size() * 2 &&
390 llvm::all_of(HexString, llvm::isHexDigit)) {
391 memcpy(Digest.data(), llvm::fromHex(HexString).data(), Digest.size());
392 } else {
393 I.setError(std::string("Bad hex file digest: ") + HexString);
394 }
395 return Digest;
396 }
397
398 std::string HexString;
399};
400
401template <> struct MappingTraits<IncludeGraphNode> {
402 static void mapping(IO &IO, IncludeGraphNode &Node) {
403 IO.mapRequired("URI", Node.URI);
404 MappingNormalization<NormalizedSourceFlag, IncludeGraphNode::SourceFlag>
405 NSourceFlag(IO, Node.Flags);
406 IO.mapRequired("Flags", NSourceFlag->Flag);
407 MappingNormalization<NormalizedFileDigest, FileDigest> NDigest(IO,
408 Node.Digest);
409 IO.mapRequired("Digest", NDigest->HexString);
410 IO.mapRequired("DirectIncludes", Node.DirectIncludes);
411 }
412};
413
414template <> struct MappingTraits<CompileCommandYAML> {
415 static void mapping(IO &IO, CompileCommandYAML &Cmd) {
416 IO.mapRequired("Directory", Cmd.Directory);
417 IO.mapRequired("CommandLine", Cmd.CommandLine);
418 }
419};
420
421template <> struct MappingTraits<VariantEntry> {
422 static void mapping(IO &IO, VariantEntry &Variant) {
423 if (IO.mapTag("!Symbol", Variant.Symbol.has_value())) {
424 if (!IO.outputting())
425 Variant.Symbol.emplace();
426 MappingTraits<Symbol>::mapping(IO, *Variant.Symbol);
427 } else if (IO.mapTag("!Refs", Variant.Refs.has_value())) {
428 if (!IO.outputting())
429 Variant.Refs.emplace();
430 MappingTraits<RefBundle>::mapping(IO, *Variant.Refs);
431 } else if (IO.mapTag("!Relations", Variant.Relation.has_value())) {
432 if (!IO.outputting())
433 Variant.Relation.emplace();
434 MappingTraits<Relation>::mapping(IO, *Variant.Relation);
435 } else if (IO.mapTag("!Source", Variant.Source.has_value())) {
436 if (!IO.outputting())
437 Variant.Source.emplace();
438 MappingTraits<IncludeGraphNode>::mapping(IO, *Variant.Source);
439 } else if (IO.mapTag("!Cmd", Variant.Cmd.has_value())) {
440 if (!IO.outputting())
441 Variant.Cmd.emplace();
442 MappingTraits<CompileCommandYAML>::mapping(
443 IO, static_cast<CompileCommandYAML &>(*Variant.Cmd));
444 }
445 }
446};
447
448} // namespace yaml
449} // namespace llvm
450
451namespace clang {
452namespace clangd {
453
454void writeYAML(const IndexFileOut &O, llvm::raw_ostream &OS) {
455 llvm::yaml::Output Yout(OS);
456 for (const auto &Sym : *O.Symbols) {
457 VariantEntry Entry;
458 Entry.Symbol = Sym;
459 Yout << Entry;
460 }
461 if (O.Refs)
462 for (auto &Sym : *O.Refs) {
463 VariantEntry Entry;
464 Entry.Refs = Sym;
465 Yout << Entry;
466 }
467 if (O.Relations)
468 for (auto &R : *O.Relations) {
469 VariantEntry Entry;
470 Entry.Relation = R;
471 Yout << Entry;
472 }
473 if (O.Sources) {
474 for (const auto &Source : *O.Sources) {
475 VariantEntry Entry;
476 Entry.Source = Source.getValue();
477 Yout << Entry;
478 }
479 }
480 if (O.Cmd) {
481 VariantEntry Entry;
482 Entry.Cmd = *O.Cmd;
483 Yout << Entry;
484 }
485}
486
487llvm::Expected<IndexFileIn> readYAML(llvm::StringRef Data,
488 SymbolOrigin Origin) {
490 RefSlab::Builder Refs;
491 RelationSlab::Builder Relations;
492 llvm::BumpPtrAllocator
493 Arena; // store the underlying data of Position::FileURI.
494 llvm::UniqueStringSaver Strings(Arena);
495 llvm::yaml::Input Yin(Data, &Strings);
496 IncludeGraph Sources;
497 std::optional<tooling::CompileCommand> Cmd;
498 while (Yin.setCurrentDocument()) {
499 llvm::yaml::EmptyContext Ctx;
500 VariantEntry Variant;
501 yamlize(Yin, Variant, true, Ctx);
502 if (Yin.error())
503 return llvm::errorCodeToError(Yin.error());
504
505 if (Variant.Symbol) {
506 Variant.Symbol->Origin = Origin;
507 Symbols.insert(*Variant.Symbol);
508 }
509 if (Variant.Refs)
510 for (const auto &Ref : Variant.Refs->second)
511 Refs.insert(Variant.Refs->first, Ref);
512 if (Variant.Relation)
513 Relations.insert(*Variant.Relation);
514 if (Variant.Source) {
515 auto &IGN = *Variant.Source;
516 auto Entry = Sources.try_emplace(IGN.URI).first;
517 Entry->getValue() = std::move(IGN);
518 // Fixup refs to refer to map keys which will live on
519 Entry->getValue().URI = Entry->getKey();
520 for (auto &Include : Entry->getValue().DirectIncludes)
521 Include = Sources.try_emplace(Include).first->getKey();
522 }
523 if (Variant.Cmd)
524 Cmd = *Variant.Cmd;
525 Yin.nextDocument();
526 }
527
528 IndexFileIn Result;
529 Result.Symbols.emplace(std::move(Symbols).build());
530 Result.Refs.emplace(std::move(Refs).build());
531 Result.Relations.emplace(std::move(Relations).build());
532 if (Sources.size())
533 Result.Sources = std::move(Sources);
534 Result.Cmd = std::move(Cmd);
535 return std::move(Result);
536}
537
538std::string toYAML(const Symbol &S) {
539 std::string Buf;
540 {
541 llvm::raw_string_ostream OS(Buf);
542 llvm::yaml::Output Yout(OS);
543 Symbol Sym = S; // copy: Yout<< requires mutability.
544 Yout << Sym;
545 }
546 return Buf;
547}
548
549std::string toYAML(const std::pair<SymbolID, llvm::ArrayRef<Ref>> &Data) {
550 RefBundle Refs = {Data.first, Data.second};
551 std::string Buf;
552 {
553 llvm::raw_string_ostream OS(Buf);
554 llvm::yaml::Output Yout(OS);
555 Yout << Refs;
556 }
557 return Buf;
558}
559
560std::string toYAML(const Relation &R) {
561 std::string Buf;
562 {
563 llvm::raw_string_ostream OS(Buf);
564 llvm::yaml::Output Yout(OS);
565 Relation Rel = R; // copy: Yout<< requires mutability.
566 Yout << Rel;
567 }
568 return Buf;
569}
570
571std::string toYAML(const Ref &R) {
572 std::string Buf;
573 {
574 llvm::raw_string_ostream OS(Buf);
575 llvm::yaml::Output Yout(OS);
576 Ref Reference = R; // copy: Yout<< requires mutability.
577 Yout << Reference;
578 }
579 return Buf;
580}
581
582} // namespace clangd
583} // namespace clang
clang::find_all_symbols::SymbolInfo SymbolInfo
clang::find_all_symbols::SymbolInfo::SymbolKind SymbolKind
#define DEFINE_ENUM(name)
#define DEFINE_ENUM_FINAL(name)
RefSlab::Builder is a mutable container that can 'freeze' to RefSlab.
Definition Ref.h:135
RelationSlab::Builder is a mutable container that can 'freeze' to RelationSlab.
Definition Relation.h:75
SymbolSlab::Builder is a mutable container that can 'freeze' to SymbolSlab.
Definition Symbol.h:238
static llvm::Expected< SymbolID > fromStr(llvm::StringRef)
Definition SymbolID.cpp:37
FIXME: Skip testing on windows temporarily due to the different escaping code mode.
Definition AST.cpp:44
llvm::Expected< IndexFileIn > readYAML(llvm::StringRef, SymbolOrigin Origin)
llvm::StringMap< IncludeGraphNode > IncludeGraph
Definition Headers.h:103
std::string toYAML(const Symbol &)
RefKind
Describes the kind of a cross-reference.
Definition Ref.h:28
void writeYAML(const IndexFileOut &, llvm::raw_ostream &)
std::array< uint8_t, 8 > FileDigest
Definition SourceCode.h:42
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Some operations such as code completion produce a set of candidates.
Definition Generators.h:150
std::vector< llvm::StringRef > DirectIncludes
Definition Headers.h:97
std::optional< RelationSlab > Relations
std::optional< SymbolSlab > Symbols
std::optional< RefSlab > Refs
std::optional< tooling::CompileCommand > Cmd
std::optional< IncludeGraph > Sources
const IncludeGraph * Sources
const RelationSlab * Relations
const tooling::CompileCommand * Cmd
const SymbolSlab * Symbols
Represents a symbol occurrence in the source file.
Definition Ref.h:88
RefKind Kind
Definition Ref.h:91
SymbolID Container
The ID of the symbol whose definition contains this reference.
Definition Ref.h:95
SymbolLocation Location
The source location where the symbol is named.
Definition Ref.h:90
Represents a relation between two symbols.
Definition Relation.h:32
RelationKind Predicate
Definition Relation.h:34
Ensure we have enough bits to represent all SymbolTag values.
Definition Symbol.h:49
SymbolFlag Flags
Definition Symbol.h:165
@ Include
#include "header.h"
Definition Symbol.h:107
@ Import
#import "header.h"
Definition Symbol.h:109
SymbolLocation Definition
The location of the symbol's definition, if one was found.
Definition Symbol.h:62
llvm::StringRef Type
Raw representation of the OpaqueType of the symbol, used for scoring purposes.
Definition Symbol.h:102
llvm::StringRef Documentation
Documentation including comment for the symbol declaration.
Definition Symbol.h:93
SymbolTags Tags
Symbol tags for LSP protocol (Deprecated, Static, Virtual, Abstract, Final, ReadOnly,...
Definition Symbol.h:78
index::SymbolInfo SymInfo
The symbol information, like symbol kind.
Definition Symbol.h:53
llvm::SmallVector< IncludeHeaderWithReferences, 1 > IncludeHeaders
One Symbol can potentially be included via different headers.
Definition Symbol.h:147
llvm::StringRef Name
The unqualified name of the symbol, e.g. "bar" (for ns::bar).
Definition Symbol.h:57
llvm::StringRef Scope
The containing namespace. e.g. "" (global), "ns::" (top-level namespace).
Definition Symbol.h:59
llvm::StringRef Signature
A brief description of the symbol that can be appended in the completion candidate list.
Definition Symbol.h:82
unsigned References
The number of translation units that reference this symbol from their main file.
Definition Symbol.h:74
llvm::StringRef ReturnType
Type when this symbol is used in an expression.
Definition Symbol.h:97
llvm::StringRef TemplateSpecializationArgs
Argument list in human-readable format, will be displayed to help disambiguate between different spec...
Definition Symbol.h:86
SymbolLocation CanonicalDeclaration
The location of the preferred declaration of the symbol.
Definition Symbol.h:71
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
Definition Symbol.h:91
SymbolID ID
The ID of the symbol.
Definition Symbol.h:51
static void mapping(IO &IO, CompileCommandYAML &Cmd)
static void mapping(IO &IO, IncludeGraphNode &Node)
static void mapping(IO &IO, RefBundle &Refs)
static void mapping(IO &IO, Ref &R)
static void mapping(IO &IO, Relation &Relation)
static void mapping(IO &IO, SymbolID &ID)
static void mapping(IO &IO, SymbolInfo &SymInfo)
static void mapping(IO &IO, SymbolLocation &Value)
static void mapping(IO &IO, Symbol &Sym)
static void mapping(IO &IO, VariantEntry &Variant)
static void mapping(IO &IO, YIncludeHeaderWithReferences &Inc)
static void mapping(IO &IO, YPosition &Value)
NormalizedFileDigest(IO &, const FileDigest &Digest)
NormalizedFileURI(IO &, const char *FileURI)
NormalizedIncludeHeaders(IO &, const llvm::SmallVector< IncludeHeader, 1 > &IncludeHeaders)
llvm::SmallVector< IncludeHeader, 1 > denormalize(IO &)
llvm::SmallVector< YIncludeHeaderWithReferences, 1 > Headers
clang::clangd::Symbol::IncludeHeaderWithReferences IncludeHeader
NormalizedPosition(IO &, const Position &Pos)
clang::clangd::SymbolLocation::Position Position
IncludeGraphNode::SourceFlag denormalize(IO &)
NormalizedSourceFlag(IO &, IncludeGraphNode::SourceFlag O)
NormalizedSymbolFlag(IO &, Symbol::SymbolFlag F)
Symbol::SymbolFlag denormalize(IO &)
NormalizedSymbolID(IO &, const SymbolID &ID)
NormalizedSymbolRole(IO &IO, RelationKind R)
static void bitset(IO &IO, clang::clangd::Symbol::IncludeDirective &Value)
static void enumeration(IO &IO, SymbolKind &Value)
static void enumeration(IO &IO, SymbolLanguage &Value)