[PATCH] D50193: Added functionality to suggest FixIts for conversion of '->' to '.' and vice versa.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 3 09:05:57 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/CodeComplete.cpp:286
+        Completion.FixIts.push_back(
+            toTextEdit(FixIt, ASTCtx.getSourceManager(), {}));
+      }
----------------
IIRC LangOptions are actually important when running lexer (that is used internally to measure the length of the tokens).
Use `ASTCtx.getLangOptions()`?


================
Comment at: clangd/SourceCode.cpp:11
 
+#include "Diagnostics.h"
 #include "Logger.h"
----------------
NIT: no need for this include in .cpp file, since the header already has that.


================
Comment at: clangd/SourceCode.h:16
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H
+#include "Diagnostics.h"
 #include "Protocol.h"
----------------
NIT: #include "clang/Basic/Diagnostic.h" should be enough here



================
Comment at: unittests/clangd/CodeCompleteTests.cpp:82
 
-CodeCompleteResult completions(ClangdServer &Server, StringRef Text,
+CodeCompleteResult completions(ClangdServer &Server, Annotations Test,
                                std::vector<Symbol> IndexSymbols = {},
----------------
Maybe accept a stringref to source code and completion point directly?
A potential use-case: `Annotaions` instance might have multiple named rangers (e.g. if you have multiple completion points in same code and want to test one after another). In that case, point() will fail with an assert if we pass `Annotations` directly


https://reviews.llvm.org/D50193





More information about the cfe-commits mailing list