[llvm-bugs] [Bug 41924] New: Add ability to pass extra flags to clangd

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 17 07:56:04 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41924

            Bug ID: 41924
           Summary: Add ability to pass extra flags to clangd
           Product: clang-tools-extra
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: clangd
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tdhutt at gmail.com
                CC: llvm-bugs at lists.llvm.org

I have a CMake project which produces a compile_commands.json file. I'm using
it with the clangd VSCode extension. I'm thinking about moving to that from Qt
Creator. However one thing Qt Creator does a lot better is that you can specify
the warning flags for its code model and have them distinct from the actual
CMake compilation flags.

For example in CMake I basically have `-Wall -Wextra -Werror`. But in Qt
Creator I have `-Weverything` which is great when editing files because I get
nice inline warnings about stuff I might not have thought about.

I obviously don't want to enabled `-Weverything -Werror` in my actual build, so
is there a way to have Clangd use different diagnostic flags to the actual
build.

Solutions I have discounted:

* Add `compile_flags.txt` containing `-Wno-error -Weverything`. I haven't
actually tried this but looking at the source code it looks like you can't use
`compile_flags.txt` *and* `compiled_commands.json`.

* Run `compile_commands.json` through a script that modifies it. I really don't
want to do this because then clangd can't monitor it for changes (I'm not sure
that actually happens in practice but it *should* happen).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190517/329d6fd3/attachment.html>


More information about the llvm-bugs mailing list