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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 10:37:47 PST 2018


sammccall added inline comments.


================
Comment at: clangd/Protocol.h:80
 struct Position {
+  Position() = default;
+  Position(int line, int character) : line(line), character(character) {}
----------------
I'd lean to making callers initialize field-by-field here rather than provide constructors.
It's not terrible here (you can get it wrong, but only one way), but it's a pattern that doesn't scale so well I think.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43230





More information about the cfe-commits mailing list