[PATCH] D42164: [clangd] Don't crash on LSP calls for non-added files
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 17 04:31:27 PST 2018
ilya-biryukov added inline comments.
================
Comment at: clangd/ClangdLSPServer.cpp:153
+
+ auto Code = Server.getDocument(File);
+ if (!Code)
----------------
sammccall wrote:
> don't you want to do this before computing replacements?
Makes sense.
================
Comment at: clangd/ClangdLSPServer.cpp:155
+ if (!Code)
+ return replyError(C, ErrorCode::InternalError,
+ "onRename called for non-added file");
----------------
sammccall wrote:
> invalidparams
I used `InternalError`, because `rename` should've returned an error for non-added file. If we do the check before calling `rename`, `InvalidParams` make more sense.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D42164
More information about the cfe-commits
mailing list