ccls: Wrong diagnostics on macOS w/ clang10
Observed behavior
compile_commands.json
[
{
"directory": "/Users/flanggut/tmp/ccls",
"file": "/Users/flanggut/tmp/ccls/main.cpp",
"arguments": [
"/usr/local/opt/llvm/bin/clang++",
"-std=c++17",
"-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include",
"-isystem /Library/Developer/CommandLineTools/usr/lib/clang/11.0.3/include/",
"-I.",
"main.cpp"
]
}
]
main.cpp
#include <chrono>
auto clk() {
return std::chrono::high_resolution_clock::now();
}
int main(int /*argc*/, char** /*argv*/) {
auto clk0 = clk();
}
ccls --index=. -v=2
Correctly identifies and and indexes all headers.
/usr/local/opt/llvm/bin/clang++ --driver-mode=g++ -std=c++17 -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -isystem /Library/Developer/CommandLineTools/usr/lib/clang/11.0.3/include/ -I. main.cpp
File compiles without issues.
In my editor ccls claims that <chrono> include cannot be found under ./chrono, note that the error is always shown for the include path -I., if I change that to -I.. the error will show that ../chrono cannot be found.
This only happens since clang/llvm10 and does not happen if I compile ccls against clang/llvm9.
Expected behavior
No diagnostics should be shown in an editor.
Steps to reproduce
brew install ccls(recently updated to use llvm10)- Open file in editor w/ ccls as language server
System information
- ccls version (
git describe --tags --long):brew info ccls - clang version: clang version 10.0.0
- OS: x86_64-apple-darwin19.4.0
- Editor: nvim / vscode
- Language client (and version): coc.nvim / vscode-ccls
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 9
- Comments: 25 (3 by maintainers)
It might be a weird interaction in the homebrew version of things. I managed to build a version using the official llvm release that runs without issues. If anyone needs a workaround for now:
this will open a terminal in a temp directory that allows you to “manually” compile and install ccls within homebrew. In there I ran
pointing cmake directly to the official llvm release (make sure the install prefix points to the right directory, homebrew will tell you where it expects the installed files). Then you just do
And homebrew automatically links ccls if you’ve installed it to the right directory.