FS#59492 - [qtcreator] clang-tidy and clazy analyzer not working correctly

Attached to Project: Arch Linux
Opened by Martin (qso) - Monday, 30 July 2018, 22:27 GMT
Last edited by Antonio Rojas (arojas) - Sunday, 26 August 2018, 08:45 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Antonio Rojas (arojas)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
In Qt Creator 4.7 clang-tidy and clazy analyzer do not produce results.
Qt Creator 4.7 binary release from Qt Project is working fine.

Additional info:
* package version(s)
qtcreator 4.7.0-1
* config and/or log files etc.
no special config, clean empty environment (deleted qtcreator's .config and .local folders),
just setup clang-tidy: tools -> options -> c++ -> code model -> select clang code model : clang-only checks for almost everything, (or any other option)

Steps to reproduce:

- open qtcreator
- setup clang-tidy: tools -> options -> c++ -> code model -> select clang code model : clang-only checks for almost everything, (or any other option)
- open a buggy c++ project
- select analyzer -> clang-tidy and clazy
- debug tab is opened project is scanned but no entries in "clang-tidy and clazy" section are produced
- the issues are detected, you can see the warning message inside the code editor in the corresponding line

When using Qt Project's Qt Creator version, all issues are reported in "clang-tidy and clazy" section as expected.
Maybe Arch's qt project is compiled with wrong compile definitions.
This task depends upon

Closed by  Antonio Rojas (arojas)
Sunday, 26 August 2018, 08:45 GMT
Reason for closing:  Fixed
Additional comments about closing:  qtcreator 4.7.0-2
Comment by Antonio Rojas (arojas) - Wednesday, 22 August 2018, 09:29 GMT
Please provide a full test case
Comment by Martin (qso) - Thursday, 23 August 2018, 22:26 GMT
1. extract and open the attached example project in qtcreator
2. open "Tools"->"Options"->"C++"->"Code Model"->"Diagnostic Configuration" = "Clang-only checks for almost everything [built-in] -> "Ok"
3. back in main window: select "Analyze"->"Clang-Tidy and Clazy"->"Analyze"
4. Debug View opens and shows "Clang-Tidy and Clazy" results with no entries!

5. Repeat all steps with binary qtcreator provided by qt.io
6. 3 results will be shown, as expected.



Comment by Antonio Rojas (arojas) - Friday, 24 August 2018, 10:24 GMT
Thanks, but are you sure those are the actual settings you're using?

With "Clang-only checks for almost everything [built-in]" I'm not getting any result
With "Clang-tidy and clazy preselected checks" I only get one
With "Clang-tidy static analyzer checks" I get the three results

(all this with upstream's binary qtcreator)
Comment by Antonio Rojas (arojas) - Friday, 24 August 2018, 13:17 GMT
The issue is in clang - moving QtCreator's bundled clang binary to /usr/bin makes our package work. Not sure what the difference could be, their bundled version is also 6.0.1
Comment by Antonio Rojas (arojas) - Friday, 24 August 2018, 14:52 GMT
Minimal test case:

/usr/bin/clang-6.0 -fsyntax-only -Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang '-checks=-*,clang-analyzer-*' /path/to/main.cpp

returns a few warnings with qtcreator's clang, but nothing with Arch's clang
Comment by Antonio Rojas (arojas) - Saturday, 25 August 2018, 22:08 GMT
Alright, found it. It's this commit in qt's clang, which is not included upstream

http://code.qt.io/cgit/clang/clang.git/commit/?id=7f349701d3ea0c47be3a43e265699dddd3fd55cf

So qtcreator requires a forked version of clang, great.

Loading...