-D__cpp_deduction_guides=0 -Wno-macro-redefined

Fangrui Song 2018-06-05 20:49:00 -07:00
parent f787152558
commit b144cd25bd
2 changed files with 16 additions and 0 deletions

12
FAQ.md

@ -42,6 +42,18 @@ Play with your `-isystem` options until you get a group of options that you can
If you want the ccls binary at a specific location use a symlink - do not move the binary itself. If you want the ccls binary at a specific location use a symlink - do not move the binary itself.
### `-std=c++1z` `-std=c++17` `bits/unordered_map.h`
In C++17 mode, it is likely to cause libclang to crash when `bits/unordered_map.h` is indexed.
See https://bugs.llvm.org/show_bug.cgi?id=37695 for details.
The workaround is to add `-D__cpp_deduction_guides=0 -Wno-macro-redefined` to the initialization option `clang.extraArgs`
In Emacs, it is:
```elisp
(setq ccls-extra-init-params
'(:clang (:extraArgs ("-D__cpp_deduction_guides=0" "-Wno-macro-redefined"))))
```
### Project root detection ### Project root detection
[emacs-ccls](https://github.com/MaskRay/emacs-cquery/) locates the project root with `ccls-project-root-matchers`: [emacs-ccls](https://github.com/MaskRay/emacs-cquery/) locates the project root with `ccls-project-root-matchers`:

@ -59,6 +59,10 @@ Note:
`.ccls` does not do *word splitting* or *command substitution* for you, `.ccls` does not do *word splitting* or *command substitution* for you,
you cannot use space-separated arguments like `%cpp -std=gnu++14 -pthread` you cannot use space-separated arguments like `%cpp -std=gnu++14 -pthread`
### Linux
If your project uses `-std=c++1z` `-std=c++17`, you likely need to add `-D__cpp_deduction_guides=0 -Wno-macro-redefined` to the initialization option `clang.extraArgs`. See [[FAQ]] for details.
### Windows ### Windows
If your project is compiled with MSVC, you may change the compiler driver (`%clang` above) to `clang-cl`, and use the initialization option `extraClangArguments` to pass three options: If your project is compiled with MSVC, you may change the compiler driver (`%clang` above) to `clang-cl`, and use the initialization option `extraClangArguments` to pass three options: