[clangd] Explicitly initialize all primitive fields in Protocol.h
Summary:
Some of the existing structs had primimtive fields that were
not explicitly initialized on construction.
After this commit every struct consistently sets a defined value for
every field when default-initialized.
Reviewers: hokein, ioeric, sammccall
Reviewed By: sammccall
Subscribers: klimek, cfe-commits, jkorous-apple
Differential Revision: https://reviews.llvm.org/D43230
llvm-svn: 325113
diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp
index e2d9f19..7ef3700 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -33,7 +33,10 @@
size_t PrevNL = Before.rfind('\n');
size_t StartOfLine = (PrevNL == StringRef::npos) ? 0 : (PrevNL + 1);
// FIXME: officially character counts UTF-16 code units, not UTF-8 bytes!
- return {Lines, static_cast<int>(Offset - StartOfLine)};
+ Position Pos;
+ Pos.line = Lines;
+ Pos.character = static_cast<int>(Offset - StartOfLine);
+ return Pos;
}
} // namespace clangd