[PATCH] D43230: [clangd] Explicitly initialize all primitive fields in Protocol.h

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 10:00:46 PST 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/Protocol.h:190
   /// (see exit notification) its process.
-  llvm::Optional<int> processId;
+  llvm::Optional<int> processId = 0;
 
----------------
jkorous-apple wrote:
> Sorry if I am asking stupid question but since the type is Optional<> isn't it's default-constructed value more appropriate here?
Totally, my mistake. Fixed now.


================
Comment at: clangd/Protocol.h:211
   /// The initial trace setting. If omitted trace is disabled ('off').
-  llvm::Optional<TraceLevel> trace;
+  llvm::Optional<TraceLevel> trace = TraceLevel::Off;
 };
----------------
jkorous-apple wrote:
> Does it still make more sense to use Optional<TraceLevel> than plain TraceLevel?
Optional here makes sense (LSP defines the field as nullable), the intializer didn't. Fixed now.




Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43230





More information about the cfe-commits mailing list