[PATCH] D64305: [clangd] Add path mappings functionality

William Wagner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 7 20:33:59 PDT 2019


wwagner19 marked 2 inline comments as done.
wwagner19 added a comment.
Herald added a subscriber: ormris.

Hey,

This is my first proposed change to LLVM, so sorry if I messed anything up. The proposed changes here follow from discussion on clangd-dev (from janruary <http://lists.llvm.org/pipermail/clangd-dev/2019-January/000231.html> and from june <http://lists.llvm.org/pipermail/clangd-dev/2019-June/000451.htm> ).
It seems like a rather large one, but fear not, most of the code is simply tests and wrapper code.

Happy to hear any feedback, thanks!



================
Comment at: clang-tools-extra/clangd/PathMapping.h:42
+/// untouched.
+llvm::json::Value doPathMapping(const llvm::json::Value &Params,
+                                bool IsIncoming, const PathMappings &Mappings);
----------------
Ideally this wouldn't be in the public interface, but I wanted to  unit test it and wasn't sure of a way to do that cleanly - other than putting it in the header.


================
Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:291
+                   "opt/include"),
+    llvm::cl::CommaSeparated);
 
----------------
Comma separated list here obviously limits the path mapping file paths, but there was precedent for this already (in `--QueryDriverGlobs`) and it seemed simplest. 

Also,a command-line argument felt the most straightforward, as I'm not aware of any clangd project settings file (please lmk if there is one :) ). Users can set up custom path mappings by using e.g. vscode workspace `settings.json`, coc.nvim `coc-settings.json`


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64305/new/

https://reviews.llvm.org/D64305





More information about the cfe-commits mailing list