summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/SourceCode.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2018-08-08 08:59:29 +0000
committerKadir Cetinkaya <kadircet@google.com>2018-08-08 08:59:29 +0000
commit2f84d911317b6c0c312ef34fd1ca20a32614ea15 (patch)
tree15180eef09fe85703271e62036cdfe09576190db /clang-tools-extra/clangd/SourceCode.cpp
parentc6a00f545c4175c94257827522d598013e213e34 (diff)
Added functionality to suggest FixIts for conversion of '->' to '.' and vice versa.
Summary: Added functionality to suggest FixIts for conversion of '->' to '.' and vice versa. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: yvvan, ioeric, jkorous, arphaman, cfe-commits, kadircet Differential Revision: https://reviews.llvm.org/D50193 llvm-svn: 339224
Diffstat (limited to 'clang-tools-extra/clangd/SourceCode.cpp')
-rw-r--r--clang-tools-extra/clangd/SourceCode.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp
index d302518b061a..88ec2c956830 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -199,5 +199,14 @@ getAbsoluteFilePath(const FileEntry *F, const SourceManager &SourceMgr) {
return FilePath.str().str();
}
+TextEdit toTextEdit(const FixItHint &FixIt, const SourceManager &M,
+ const LangOptions &L) {
+ TextEdit Result;
+ Result.range =
+ halfOpenToRange(M, Lexer::makeFileCharRange(FixIt.RemoveRange, M, L));
+ Result.newText = FixIt.CodeToInsert;
+ return Result;
+}
+
} // namespace clangd
} // namespace clang