New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clangd-indexer should use or document -extra-arg="-Wno-everything" #24
Comments
After more thought - does the background indexer for clangd have an equivalent option for: -extra-arg="-Wno-everything" I assume clangd would fail to index code that clang would fail to compile if it hits an -Werror type of warning. Bearing in mind that g++ wouldn't fail to compile the same code, hence the compiler options do not specify to ignore the problematic warnings. |
For some more context: Effectively what we need is for clangd to honour the fact the compile_commands.json specifies 'g++' and turn off all clang++ specific warnings. This could be done automatically, or via a command line option to provide additional args to the compiler, similar to what clangd-indexer supports. It may be necessary have two sets of 'extra-args'. One for the indexer, which would be safe to turn off all warnings, and another setting for the diagnostics where you'd likely want to leave on all the g++ warnings. |
Yeah there are a few different ways to address your problem, but i think the cleanest is to disable all warnings during indexing as you suggest. This should happen for all the different types of indexing we do (static, dynamic, background, it's a mess...). Futzing with compile commands is always fiddly (it can be a clang-cl style command line too!) but that's just a better reason to do this in one place. |
I can't help but think clang should have a gcc version x compatible mode where it disables additional warnings that gcc version x doesn't have. Or at the very least doesn't convert them into errors even if asked to. I assume it hasn't been asked for often enough to warrant doing. |
Turns out this assumption doesn't hold :-) Non-fatal errors don't stop indexing, and all symbols are still collected. However there are still reasons to do this:
|
Summary: - we don't record the warnings at all - we don't want to stop indexing if we hit error-limit due to warnings - this allows some analyses to be skipped which can save some CPU clangd/clangd#24 Reviewers: hokein Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59935 llvm-svn: 357186
Summary: - we don't record the warnings at all - we don't want to stop indexing if we hit error-limit due to warnings - this allows some analyses to be skipped which can save some CPU clangd/clangd#24 Reviewers: hokein Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59935 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@357186 91177308-0d34-0410-b5e6-96231b3b80d8
Fixed in https://reviews.llvm.org/rL357186
I can see how this would be desirable, though it also sounds hard to keep in sync. In any case that's indeed a FR for clang. |
Summary: - we don't record the warnings at all - we don't want to stop indexing if we hit error-limit due to warnings - this allows some analyses to be skipped which can save some CPU clangd/clangd#24 Reviewers: hokein Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59935 llvm-svn: 357186
Summary: - we don't record the warnings at all - we don't want to stop indexing if we hit error-limit due to warnings - this allows some analyses to be skipped which can save some CPU clangd/clangd#24 Reviewers: hokein Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59935 llvm-svn: 357186
Projects that use g++ may not necessarily compile cleanly with clang due to several warnings treated as errors. The following option to clangd-indexer significantly helps in creating a useful index for these projects:
-extra-arg="-Wno-everything"
Given the purpose of the index, perhaps this should be the default option?
If not, maybe it could at least be promoted more in documentation/usage as it results in a much more useful index for the purposes of symbol lookups etc.
The text was updated successfully, but these errors were encountered: