ch1bo / flycheck-clang-tidy

Flycheck syntax checker using clang-tidy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to debug flycheck-list-errors not showing anything

emacs18 opened this issue · comments

I have flycheck-clang-tidy working on ubuntu 20.04. flycheck-list-errors shows issues, and I can examine the issues using next-error, previous-error, flycheck-explain-error-at-point, etc. So I think everything is working as they should.
However I cannot get flycheck-list-errors to list the issues on CentOS 7. flycheck-verify-setup reports that all is setup correctly. flycheck-compile also works in that clang-tidy is run and warnings reported in compilation buffer. However flycheck-list-errors displays empty content in *Flycheck errors* buffer!

How can I debug this? What optional debug facilities are available?

I submitted #14 to address the reported problem.

Can you provide a minimal Emacs configuration, your clang version and a link to the project it fails with?

I use spacemacs. Clang 7 on CentOS 7. I can't share source code that I tested on so far. If it would help, I can test drive clang-tidy on llvm source code to see if it works any differently. Also I can test drive latest clang as well.

I've tried your patch from #14 (comment) and saw no error regarding the compilation database, even with flycheck-clang-tidy-build-path set to build and compile_commands.json moved to the project root it was found.

The fact that it works with the original file but not with a temporary file leads me to the assumption that we maybe could not detect the project's root directory. Can you share the output of (flycheck-clang-tidy-find-project-root nil), evaluated in the buffer you want to check?

I don't think the llvm source code would be any different but if you could test it with a more recent version of clang-tidy that would be great.

I built llvm using latest main branch source code as of yesterday. Using clang-tidy from this build, I encounter the same failure as before on llvm-project/llvm/lib/Analysis/BlockFrequencyInfo.cpp file. If I use my flycheck debug code that I detailed in my PR, following is returned by clang-tidy, i.e., the call back to start-proecess calls flycheck-receive-checker-output and passes the line below to it:

Skipping /tmp/flycheckDxEDuX/BlockFrequencyInfo.cpp. Compile command not found.

As I reported before, flycheck-compile works just fine. This is probably because it is not using a copy of the C++ file under /tmp directory. Also applying the one line change in my PR fixes so that flycheck-buffer now reports the same information as flycheck-compile.

I suspect that this is a problem on an old OS such as CentOS 7.3. With all else being similar, I do not see this problem on Ubuntu 20.04.

Hmm. I guess we can add an option to always use source-original. Do you mind adding a toggle to your PR?

I added toggle via #15
However this is a hack that I came up with because I don't know a better way.
I don't think this should be checked in.
I may just use my own forked version of flycheck-clang-tidy to use 'source-original.