alexmurray / flycheck-clang-analyzer

Integrate Clang Static Analyzer with flycheck for on-the-fly static analysis in Emacs
35 stars 5 forks source link

Ccls support #10

Closed innerout closed 6 years ago

innerout commented 6 years ago

Does this plugin support Ccls?It is a fork of cquery.

alexmurray commented 6 years ago

Not currently but from a quick look it seems like a ccls backend could be added which just uses the same forked functions as the cquery one - if I add something could you test it?

alexmurray commented 6 years ago

Can you try the code in branch ccls-support https://github.com/alexmurray/flycheck-clang-analyzer/tree/ccls-support ?

innerout commented 6 years ago

Going to test and give some feedback later.

innerout commented 6 years ago

This error is being reported when using the ccls branch. Also i tried the master branch with cquery and it does not trigger this behaviour.

Suspicious state from syntax checker clang-analyzer: Flycheck checker clang-analyzer returned 
non-zero exit code 1, but its output contained no errors: clang-6.0: fatal error: 
cannot specify -o when generating multiple output files

Try installing a more recent version of clang-analyzer, and please 
open a bug report if the issue persists in the latest release.  Thanks!
alexmurray commented 6 years ago

Can you try the following and post the output when using the ccls branch:

M-: (flycheck-clang-analyzer--ccls-get-compile-options)

And then also do the equivalent for the cquery backend on the master branch:

M-: (flycheck-clang-analyzer--cquery-get-compile-options)

I think the ccls backend is adding extra arguments which aren't in the cquery one to the compiler flags which we will likely need to filter out.

innerout commented 6 years ago

For cquery the command reports ("-working-directory=/home/geo/HEutropia/kreon" "-g" "-ggdb3" "-Wall" "-O3" "-DSTANDALONE" "-Wfatal-errors" "-pthread" "-fPIC" "/home/geo/HEutropia/kreon/btree/btree.c" "-resource-dir=/home/geo/cquery/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-14.04/lib/clang/6.0.0" "-Wno-unknown-warning-option" ...)

For ccls the command reports

("-c" "-g" "-ggdb3" "-Wall" "-O3" "-DSTANDALONE" "-Wfatal-errors" "-pthread" "-fPIC" "-o" "btree/btree.o" "/home/geo/HEutropia/kreon/btree/btree.c" ...)
alexmurray commented 6 years ago

Can you try the latest change I just pushed to the ccls-support branch?

innerout commented 6 years ago

I am gonna test and give feedback soon.

innerout commented 6 years ago

I tested on 2 different projects(small-big size) both seemed to work just fine. The only problem i encountered when i ran it with a big C file with 5k LOC, is that flycheck-clang-analyzer is being disabled because it reports more than 600 warnings-errors. I realize it is not a problem of the flycheck-clang-analyzer but has this behaviour occurred to you?

alexmurray commented 6 years ago

Great to hear it works! Any chance you can test via cquery as well (but on this new ccls branch) to check we haven't broken cquery support? Then I will merge this to master.

No I haven't seen that before - are they all real / correct warnings?

innerout commented 6 years ago

I don't know if they are real / correct warnings because as soon as the message is printed flycheck-clang-analyzer is disabled.

alexmurray commented 6 years ago

You could try increasing the limit by setting flycheck-checker-error-threshold to a higher value (I am pretty sure this is the variable which governs that)

innerout commented 6 years ago

You were correct.After changing the value of the variable this error is not being reported. Also cquery is working fine.

alexmurray commented 6 years ago

Great - thanks for all your testing. I'll merge it to master and it should be available on MELPA in 24h.