@@ -72,7 +72,7 @@ Marshaller::Marshaller(llvm::StringRef RemoteIndexRoot,
72
72
}
73
73
74
74
llvm::Expected<clangd::LookupRequest>
75
- Marshaller::fromProtobuf (const LookupRequest *Message) {
75
+ Marshaller::fromProtobuf (const v1:: LookupRequest *Message) {
76
76
clangd::LookupRequest Req;
77
77
auto IDs = getIDs (Message->ids ());
78
78
if (!IDs)
@@ -82,7 +82,7 @@ Marshaller::fromProtobuf(const LookupRequest *Message) {
82
82
}
83
83
84
84
llvm::Expected<clangd::FuzzyFindRequest>
85
- Marshaller::fromProtobuf (const FuzzyFindRequest *Message) {
85
+ Marshaller::fromProtobuf (const v1:: FuzzyFindRequest *Message) {
86
86
assert (RemoteIndexRoot);
87
87
clangd::FuzzyFindRequest Result;
88
88
Result.Query = Message->query ();
@@ -106,7 +106,7 @@ Marshaller::fromProtobuf(const FuzzyFindRequest *Message) {
106
106
}
107
107
108
108
llvm::Expected<clangd::RefsRequest>
109
- Marshaller::fromProtobuf (const RefsRequest *Message) {
109
+ Marshaller::fromProtobuf (const v1:: RefsRequest *Message) {
110
110
clangd::RefsRequest Req;
111
111
auto IDs = getIDs (Message->ids ());
112
112
if (!IDs)
@@ -119,7 +119,7 @@ Marshaller::fromProtobuf(const RefsRequest *Message) {
119
119
}
120
120
121
121
llvm::Expected<clangd::RelationsRequest>
122
- Marshaller::fromProtobuf (const RelationsRequest *Message) {
122
+ Marshaller::fromProtobuf (const v1:: RelationsRequest *Message) {
123
123
clangd::RelationsRequest Req;
124
124
auto IDs = getIDs (Message->subjects ());
125
125
if (!IDs)
@@ -131,7 +131,8 @@ Marshaller::fromProtobuf(const RelationsRequest *Message) {
131
131
return Req;
132
132
}
133
133
134
- llvm::Expected<clangd::Symbol> Marshaller::fromProtobuf (const Symbol &Message) {
134
+ llvm::Expected<clangd::Symbol>
135
+ Marshaller::fromProtobuf (const v1::Symbol &Message) {
135
136
if (!Message.has_info () || !Message.has_canonical_declaration ())
136
137
return error (" Missing info or declaration." );
137
138
clangd::Symbol Result;
@@ -169,7 +170,7 @@ llvm::Expected<clangd::Symbol> Marshaller::fromProtobuf(const Symbol &Message) {
169
170
return Result;
170
171
}
171
172
172
- llvm::Expected<clangd::Ref> Marshaller::fromProtobuf (const Ref &Message) {
173
+ llvm::Expected<clangd::Ref> Marshaller::fromProtobuf (const v1:: Ref &Message) {
173
174
if (!Message.has_location ())
174
175
return error (" Missing location." );
175
176
clangd::Ref Result;
@@ -182,7 +183,7 @@ llvm::Expected<clangd::Ref> Marshaller::fromProtobuf(const Ref &Message) {
182
183
}
183
184
184
185
llvm::Expected<std::pair<clangd::SymbolID, clangd::Symbol>>
185
- Marshaller::fromProtobuf (const Relation &Message) {
186
+ Marshaller::fromProtobuf (const v1:: Relation &Message) {
186
187
auto SubjectID = SymbolID::fromStr (Message.subject_id ());
187
188
if (!SubjectID)
188
189
return SubjectID.takeError ();
@@ -194,16 +195,17 @@ Marshaller::fromProtobuf(const Relation &Message) {
194
195
return std::make_pair (*SubjectID, *Object);
195
196
}
196
197
197
- LookupRequest Marshaller::toProtobuf (const clangd::LookupRequest &From) {
198
- LookupRequest RPCRequest;
198
+ v1:: LookupRequest Marshaller::toProtobuf (const clangd::LookupRequest &From) {
199
+ v1:: LookupRequest RPCRequest;
199
200
for (const auto &SymbolID : From.IDs )
200
201
RPCRequest.add_ids (SymbolID.str ());
201
202
return RPCRequest;
202
203
}
203
204
204
- FuzzyFindRequest Marshaller::toProtobuf (const clangd::FuzzyFindRequest &From) {
205
+ v1::FuzzyFindRequest
206
+ Marshaller::toProtobuf (const clangd::FuzzyFindRequest &From) {
205
207
assert (LocalIndexRoot);
206
- FuzzyFindRequest RPCRequest;
208
+ v1:: FuzzyFindRequest RPCRequest;
207
209
RPCRequest.set_query (From.Query );
208
210
for (const auto &Scope : From.Scopes )
209
211
RPCRequest.add_scopes (Scope);
@@ -222,8 +224,8 @@ FuzzyFindRequest Marshaller::toProtobuf(const clangd::FuzzyFindRequest &From) {
222
224
return RPCRequest;
223
225
}
224
226
225
- RefsRequest Marshaller::toProtobuf (const clangd::RefsRequest &From) {
226
- RefsRequest RPCRequest;
227
+ v1:: RefsRequest Marshaller::toProtobuf (const clangd::RefsRequest &From) {
228
+ v1:: RefsRequest RPCRequest;
227
229
for (const auto &ID : From.IDs )
228
230
RPCRequest.add_ids (ID.str ());
229
231
RPCRequest.set_filter (static_cast <uint32_t >(From.Filter ));
@@ -232,8 +234,9 @@ RefsRequest Marshaller::toProtobuf(const clangd::RefsRequest &From) {
232
234
return RPCRequest;
233
235
}
234
236
235
- RelationsRequest Marshaller::toProtobuf (const clangd::RelationsRequest &From) {
236
- RelationsRequest RPCRequest;
237
+ v1::RelationsRequest
238
+ Marshaller::toProtobuf (const clangd::RelationsRequest &From) {
239
+ v1::RelationsRequest RPCRequest;
237
240
for (const auto &ID : From.Subjects )
238
241
RPCRequest.add_subjects (ID.str ());
239
242
RPCRequest.set_predicate (static_cast <uint32_t >(From.Predicate ));
@@ -242,8 +245,8 @@ RelationsRequest Marshaller::toProtobuf(const clangd::RelationsRequest &From) {
242
245
return RPCRequest;
243
246
}
244
247
245
- llvm::Expected<Symbol> Marshaller::toProtobuf (const clangd::Symbol &From) {
246
- Symbol Result;
248
+ llvm::Expected<v1:: Symbol> Marshaller::toProtobuf (const clangd::Symbol &From) {
249
+ v1:: Symbol Result;
247
250
Result.set_id (From.ID .str ());
248
251
*Result.mutable_info () = toProtobuf (From.SymInfo );
249
252
Result.set_name (From.Name .str ());
@@ -278,8 +281,8 @@ llvm::Expected<Symbol> Marshaller::toProtobuf(const clangd::Symbol &From) {
278
281
return Result;
279
282
}
280
283
281
- llvm::Expected<Ref> Marshaller::toProtobuf (const clangd::Ref &From) {
282
- Ref Result;
284
+ llvm::Expected<v1:: Ref> Marshaller::toProtobuf (const clangd::Ref &From) {
285
+ v1:: Ref Result;
283
286
Result.set_kind (static_cast <uint32_t >(From.Kind ));
284
287
auto Location = toProtobuf (From.Location );
285
288
if (!Location)
@@ -288,9 +291,10 @@ llvm::Expected<Ref> Marshaller::toProtobuf(const clangd::Ref &From) {
288
291
return Result;
289
292
}
290
293
291
- llvm::Expected<Relation> Marshaller::toProtobuf (const clangd::SymbolID &Subject,
292
- const clangd::Symbol &Object) {
293
- Relation Result;
294
+ llvm::Expected<v1::Relation>
295
+ Marshaller::toProtobuf (const clangd::SymbolID &Subject,
296
+ const clangd::Symbol &Object) {
297
+ v1::Relation Result;
294
298
*Result.mutable_subject_id () = Subject.str ();
295
299
auto SerializedObject = toProtobuf (Object);
296
300
if (!SerializedObject)
@@ -335,22 +339,23 @@ llvm::Expected<std::string> Marshaller::uriToRelativePath(llvm::StringRef URI) {
335
339
}
336
340
337
341
clangd::SymbolLocation::Position
338
- Marshaller::fromProtobuf (const Position &Message) {
342
+ Marshaller::fromProtobuf (const v1:: Position &Message) {
339
343
clangd::SymbolLocation::Position Result;
340
344
Result.setColumn (static_cast <uint32_t >(Message.column ()));
341
345
Result.setLine (static_cast <uint32_t >(Message.line ()));
342
346
return Result;
343
347
}
344
348
345
- Position
349
+ v1:: Position
346
350
Marshaller::toProtobuf (const clangd::SymbolLocation::Position &Position) {
347
- remote::Position Result;
351
+ remote::v1:: Position Result;
348
352
Result.set_column (Position.column ());
349
353
Result.set_line (Position.line ());
350
354
return Result;
351
355
}
352
356
353
- clang::index::SymbolInfo Marshaller::fromProtobuf (const SymbolInfo &Message) {
357
+ clang::index::SymbolInfo
358
+ Marshaller::fromProtobuf (const v1::SymbolInfo &Message) {
354
359
clang::index::SymbolInfo Result;
355
360
Result.Kind = static_cast <clang::index::SymbolKind>(Message.kind ());
356
361
Result.SubKind = static_cast <clang::index::SymbolSubKind>(Message.subkind ());
@@ -360,8 +365,8 @@ clang::index::SymbolInfo Marshaller::fromProtobuf(const SymbolInfo &Message) {
360
365
return Result;
361
366
}
362
367
363
- SymbolInfo Marshaller::toProtobuf (const clang::index::SymbolInfo &Info) {
364
- SymbolInfo Result;
368
+ v1:: SymbolInfo Marshaller::toProtobuf (const clang::index::SymbolInfo &Info) {
369
+ v1:: SymbolInfo Result;
365
370
Result.set_kind (static_cast <uint32_t >(Info.Kind ));
366
371
Result.set_subkind (static_cast <uint32_t >(Info.SubKind ));
367
372
Result.set_language (static_cast <uint32_t >(Info.Lang ));
@@ -370,7 +375,7 @@ SymbolInfo Marshaller::toProtobuf(const clang::index::SymbolInfo &Info) {
370
375
}
371
376
372
377
llvm::Expected<clangd::SymbolLocation>
373
- Marshaller::fromProtobuf (const SymbolLocation &Message) {
378
+ Marshaller::fromProtobuf (const v1:: SymbolLocation &Message) {
374
379
clangd::SymbolLocation Location;
375
380
auto URIString = relativePathToURI (Message.file_path ());
376
381
if (!URIString)
@@ -381,9 +386,9 @@ Marshaller::fromProtobuf(const SymbolLocation &Message) {
381
386
return Location;
382
387
}
383
388
384
- llvm::Expected<SymbolLocation>
389
+ llvm::Expected<v1:: SymbolLocation>
385
390
Marshaller::toProtobuf (const clangd::SymbolLocation &Location) {
386
- remote::SymbolLocation Result;
391
+ remote::v1:: SymbolLocation Result;
387
392
auto RelativePath = uriToRelativePath (Location.FileURI );
388
393
if (!RelativePath)
389
394
return RelativePath.takeError ();
@@ -393,9 +398,9 @@ Marshaller::toProtobuf(const clangd::SymbolLocation &Location) {
393
398
return Result;
394
399
}
395
400
396
- llvm::Expected<HeaderWithReferences> Marshaller::toProtobuf (
401
+ llvm::Expected<v1:: HeaderWithReferences> Marshaller::toProtobuf (
397
402
const clangd::Symbol::IncludeHeaderWithReferences &IncludeHeader) {
398
- HeaderWithReferences Result;
403
+ v1:: HeaderWithReferences Result;
399
404
Result.set_references (IncludeHeader.References );
400
405
const std::string Header = IncludeHeader.IncludeHeader .str ();
401
406
if (isLiteralInclude (Header)) {
@@ -410,7 +415,7 @@ llvm::Expected<HeaderWithReferences> Marshaller::toProtobuf(
410
415
}
411
416
412
417
llvm::Expected<clangd::Symbol::IncludeHeaderWithReferences>
413
- Marshaller::fromProtobuf (const HeaderWithReferences &Message) {
418
+ Marshaller::fromProtobuf (const v1:: HeaderWithReferences &Message) {
414
419
std::string Header = Message.header ();
415
420
if (!isLiteralInclude (Header)) {
416
421
auto URIString = relativePathToURI (Header);
0 commit comments