From e9a133c9dcb137ba56f2ba39189a3dee766ce07e Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 28 Jul 2018 20:15:17 -0700 Subject: [PATCH] Emacs --- Emacs.md | 9 ++++++--- FAQ.md | 10 ---------- Getting-started.md | 6 ++++-- compile_commands.json.md | 9 +++++++++ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Emacs.md b/Emacs.md index 1a9f48a..a669796 100644 --- a/Emacs.md +++ b/Emacs.md @@ -55,9 +55,12 @@ To turn on ccls for all C/C++ modes: (lsp-ccls-enable) (user-error nil))) - (use-package ccls - :commands lsp-ccls-enable - :init (add-hook 'c-mode-common-hook #'ccls//enable)) +(use-package ccls + :commands lsp-ccls-enable + :init + (add-hook 'c-common-hook #'ccls//enable) + (add-hook 'c++-common-hook #'ccls//enable) + ) ;; Also see lsp-project-whitelist lsp-project-blacklist ccls-root-matchers ``` diff --git a/FAQ.md b/FAQ.md index 50a7ce0..ce5b7bd 100644 --- a/FAQ.md +++ b/FAQ.md @@ -147,16 +147,6 @@ ccls will save a file in `cacheDirectory`: ... ``` -### AST deserialisation error when precompiled headers are used - -Unfortunately, libclang is very picky when it comes to precompiled headers. Even if your system compiler and the bundled libclang are the same versions there will be problems. Namely, to avoid AST deresialisation errors while using PCH, you need to create them with the same toolchain which will be used inside ccls for completions. - -However, making ccls use precompiled headers doesn't make much sense. Libclang will internally create the precompiled headers, but won't store them on permanent storage, so having precompiled headers upfront only speeds up the initial parse - precompiled headers shouldn't make a difference on subsequent parses. - -Going back to "create precompiled headers with the same toolchain that will be used by ccls", you can still use precompiled headers, but you will be forced to use your system's libclang, not the one bundled with cquery (even though the bundled one is what's tested). - -For reference, read [Valloric/ycmd#892](https://github.com/Valloric/ycmd/issues/892) and [cquery-project/cquery#545](https://github.com/cquery-project/cquery/issues/545). - ### Definitions `textDocument/definition` can be used in many places. Some are current implementation details and may subject to change. diff --git a/Getting-started.md b/Getting-started.md index 8dfca44..8d22bce 100644 --- a/Getting-started.md +++ b/Getting-started.md @@ -23,14 +23,16 @@ The executable is at `release/ccls`. Additional notes: If your `libstdc++` is too old (no C++17 header files) or have an old GCC/Clang, you may use the `-DCLANG_USE_BUNDLED_LIBC++=on` command at [[Build]]. -* Arch Linux: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`. `-DUSE_SHARED_LLVM=on` (optional) makes linked executable smaller. +* Arch Linux: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`. [aur/ccls-git](https://aur.archlinux.org/packages/ccls-git) currently does not work as it links against `extra/clang=6.0.1-1` which has a [known issue](https://github.com/MaskRay/ccls/issues/30). * FreeBSD - + with `llvm60` installed: `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DCMAKE_PREFIX=/usr/local/llvm60` + + with `llvm60` installed: `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DCMAKE_PREFIX_PATH=/usr/local/llvm60` + use libc++: `cmake -H. -BRelease -DCLANG_USE_BUNDLED_LIBC++=on` * Linux with newer libstdc++ and clang>=6: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on` * Linux with `gcc < 7` but `clang >= 5`, `cmake -H. -BRelease -DCMAKE_CXX_COMPILER=clang++` +`-DUSE_SHARED_LLVM=on` (optional) makes linked executable smaller. + ### Setup your editor Find your editor from the sidebar under the section "Editor configuration". diff --git a/compile_commands.json.md b/compile_commands.json.md index c6b7755..b1be6bc 100644 --- a/compile_commands.json.md +++ b/compile_commands.json.md @@ -99,6 +99,15 @@ yes '' | make config bear make -j bzImage modules ``` +### musl + +```zsh +mkdir Debug; cd Debug +../configure --enable-optimize=no --enable-debug --prefix=~/.local/stow/musl +bear make -j +cd ..; ln -s Debug/compile_commands.json +``` + ## Misc `compile_commands.json` should reside in the project root. Set the initialization option `compilationDatabaseDirectory` for an alternative directory containing `compile_commands.json`.