summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/SourceCode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/SourceCode.cpp')
-rw-r--r--clang-tools-extra/clangd/SourceCode.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp
index e2d9f19e6bc..7ef3700681f 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -33,7 +33,10 @@ Position offsetToPosition(StringRef Code, size_t Offset) {
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
OpenPOWER on IntegriCloud