From b144cd25bd086ac2b5c80b24b518708609dffecd Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 5 Jun 2018 20:49:00 -0700 Subject: [PATCH] -D__cpp_deduction_guides=0 -Wno-macro-redefined --- FAQ.md | 12 ++++++++++++ Getting-started.md | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/FAQ.md b/FAQ.md index 765dfef..2bcc431 100644 --- a/FAQ.md +++ b/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. +### `-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 [emacs-ccls](https://github.com/MaskRay/emacs-cquery/) locates the project root with `ccls-project-root-matchers`: diff --git a/Getting-started.md b/Getting-started.md index 6385f9b..3839e3a 100644 --- a/Getting-started.md +++ b/Getting-started.md @@ -59,6 +59,10 @@ Note: `.ccls` does not do *word splitting* or *command substitution* for you, 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 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: