File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ message Relation {
133133}
134134
135135message ContainedRefsRequest {
136- required string id = 1 ;
136+ optional string id = 1 ;
137137 optional uint32 limit = 2 ;
138138}
139139
@@ -145,7 +145,7 @@ message ContainedRefsReply {
145145}
146146
147147message ContainedRef {
148- required SymbolLocation location = 1 ;
149- required uint32 kind = 2 ;
150- required string symbol = 3 ;
148+ optional SymbolLocation location = 1 ;
149+ optional uint32 kind = 2 ;
150+ optional string symbol = 3 ;
151151}
Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ Marshaller::fromProtobuf(const RefsRequest *Message) {
129129llvm::Expected<clangd::ContainedRefsRequest>
130130Marshaller::fromProtobuf (const ContainedRefsRequest *Message) {
131131 clangd::ContainedRefsRequest Req;
132+ if (!Message->has_id ())
133+ return error (" ContainedRefsRequest requires an id." );
132134 auto ID = SymbolID::fromStr (Message->id ());
133135 if (!ID)
134136 return ID.takeError ();
@@ -207,6 +209,12 @@ llvm::Expected<clangd::Ref> Marshaller::fromProtobuf(const Ref &Message) {
207209llvm::Expected<clangd::ContainedRefsResult>
208210Marshaller::fromProtobuf (const ContainedRef &Message) {
209211 clangd::ContainedRefsResult Result;
212+ if (!Message.has_location ())
213+ return error (" ContainedRef must have a location." );
214+ if (!Message.has_kind ())
215+ return error (" ContainedRef must have a kind." );
216+ if (!Message.has_symbol ())
217+ return error (" ContainedRef must have a symbol." );
210218 auto Location = fromProtobuf (Message.location ());
211219 if (!Location)
212220 return Location.takeError ();
You can’t perform that action at this time.
0 commit comments