mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-28 18:41:57 +00:00
Update FAQ: -resource-dir is no longer recorded
parent
2a16b9c89d
commit
021bf49869
62
FAQ.md
62
FAQ.md
@ -33,10 +33,6 @@ For CMake this can be achieved in a single line: `target_include_directories(<ta
|
||||
|
||||
Check `Clang_EXECUTABLE` in your `CMakeCache.txt`. The output of command `$Clang_EXECUTABLE -print-resource-dir` will be passed to `-DDEFAULT_RESOURCE_DIRECTORY`. Make sure you can locate `include/stddef.h` in the resource directory.
|
||||
|
||||
Read [[Initialization options]] how to set `"cacheFormat": "json"`.
|
||||
If `"cacheDirectory": "/tmp/ccls"`, and the source file is `/tmp/c/a.cc`,
|
||||
run `jq . < /tmp/ccls/@tmp@c/a.cc.json` to see if `-resource-dir` is correct, e.g. `"-resource-dir=/home/ray/ccls/Debug/lib/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/clang/6.0.0"`
|
||||
|
||||
#### `-isystem`
|
||||
|
||||
ccls infers system search paths (e.g. `/usr/include`). The underneath mechanism is similar to that of `clang -v -E -x c++ /dev/null`.
|
||||
@ -54,6 +50,13 @@ If you want to specify additional search paths:
|
||||
* `print '%clang\n%cpp -std=gnu++17\n-isystem/tmp/include' > .ccls`
|
||||
* emacs-ccls: `(setq ccls-extra-init-params '(:clang (:extraArgs ["-isystem" "/tmp/include"])))`
|
||||
|
||||
### Inspect index files
|
||||
|
||||
Read [[Initialization options]] how to set `"cacheFormat": "json"`.
|
||||
|
||||
If `"cacheDirectory": "/tmp/ccls"`, and the source file is `/tmp/c/a.cc`,
|
||||
run `jq . < /tmp/ccls/@tmp@c/a.cc.json`
|
||||
|
||||
### Project root detection
|
||||
|
||||
[emacs-ccls](https://github.com/MaskRay/emacs-cquery/) locates the project root in the following order:
|
||||
@ -88,57 +91,6 @@ ulimit -n 32768
|
||||
* soft nofile 32768
|
||||
```
|
||||
|
||||
### Includes
|
||||
|
||||
Here is an example.
|
||||
|
||||
`include/a.h`:
|
||||
```c
|
||||
int bad;
|
||||
```
|
||||
|
||||
`a.cc`:
|
||||
```c
|
||||
int main(){return bad;}
|
||||
```
|
||||
|
||||
`.ccls`:
|
||||
```text
|
||||
%clang
|
||||
%cpp -std=gnu++14
|
||||
-Iinclude
|
||||
```
|
||||
|
||||
ccls will save a file in `cacheDirectory`:
|
||||
`jq . < /tmp/ccls/@tmp@c/a.cc.json`
|
||||
```json
|
||||
15
|
||||
{
|
||||
"last_modification_time": 1520737513,
|
||||
"language": 1,
|
||||
"import_file": "/tmp/c/a.cc",
|
||||
"args": [
|
||||
"clang++",
|
||||
"-working-directory=/tmp/c",
|
||||
"-std=gnu++14",
|
||||
"-Iinclude",
|
||||
"/tmp/c/a.cc",
|
||||
"-resource-dir=/home/maskray/Dev/Util/ccls/build/debug/lib/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-14.04/lib/clang/6.0.0",
|
||||
"-Wno-unknown-warning-option",
|
||||
"-fparse-all-comments"
|
||||
],
|
||||
"includes": [
|
||||
{
|
||||
"line": 0,
|
||||
"resolved_path": "/tmp/c/include/a.h"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
"/tmp/c/include/a.h"
|
||||
],
|
||||
...
|
||||
```
|
||||
|
||||
### Diagnostics in headers
|
||||
|
||||
For efficiency, headers are compiled on their own (as if `clang [options] a.h`) to utilize Clang's preamble optimization.
|
||||
|
Loading…
Reference in New Issue
Block a user