MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 254 forks source link

Permanent "not indexed" error with Clang 12 and above #874

Open madscientist opened 2 years ago

madscientist commented 2 years ago

Observed behavior

Everything works great when I compile ccls against versions of Clang up to and including 11.1.0.

When I compile ccls against anything newer (well, tested with 12.0 and 14.0), and no other changes at all just a different clang, then I get nothing: all I see in my LSP client is "not indexed". LSP mode shows in the minibuffer:

LSP :: Error from the Language Server: not indexed (Invalid Request)

I've enabled --log-file=ccls.out -v=9 and looked at the log file and there is absolutely nothing odd there: no error messages or warnings or anything.

I've enabled client logging on the Emacs LSP mode and all I ever get back from ccls is:

[Trace - 02:03:46 PM] Received response 'nil - (22)' in 999ms.
Result: {
  "message": "not indexed",
  "code": -32600
}

[Trace - 02:03:46 PM] Received response 'textDocument/documentHighlight - (23)' in 31ms.
Result: {
  "message": "not indexed",
  "code": -32600
}

It appears that indexing never proceeds or succeeds, but there's absolutely nothing that I can find in any logging that would explain why or how to fix it.

Also, no files are ever created in the .ccls-cache directory!

Steps to reproduce

I doubt it's reproducible outside my environment, unless others also have problems using Clang 12+.

What I really need is some kind of pointer that allows me to get more debugging or figure out why the indexing just never seems to do anything. Is there a way to compile ccls with more debugging output?

System information

MaskRay commented 2 years ago

If you use something like ccls --index $root, there is a log at src/indexer.cc:1367 LOG_S(ERROR) << "failed to index " << main. The variable reason may be interesting.

Interactive debugging may help. cgdb --args path/to/debug/ccls --index $root