I am using version 1.87 on windows.
But if I do a cppcheck run over my visual studio solution,
there is not a single clang result found.
And this is very unlikely thats why I assume
there is something not working correctly.
At "Settings -> Clang" I tried with applying the clang path
C:/Program Files/LLVM/bin
as well as leaving it blank.
Also the clang executable path is applied to the environment path variable.
Any ideas why there is no clang result shown?
Also the icon at the toolbar is activated like the other ones to.
When I activated the "Clang-Tidy" radio button at "Projektfile->Addons and Tools" I get clang tidy results interestingly.
Best regards,
gibson
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
IIRC Clang-Tidy can only be used if a project file (like a .sln file) is used because it needs to know all includes, definitions and so on.
So it might work as intended because you write that it works when you create a project (i guess it is a project using a .sln file?) and enable Clang-Tidy for that project.
I had the same problem (and others too i guess) that it is unclear whether Clang-Tidy is acutally used and if not why it is not used.
Any idea how this can be made more clear or otherwise improved?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, yes I am using a cppcheck project with a given Visual Studio .sln file. Clang-Tidy works as expected. But I am missing any clang compiler messages. If I do a run only with clang results enabled at the toolbar nothing gets found at all. With about 3000 files I would expect dozens of warnings or errors.
I tried it with a project for the cppcheck.sln and it works here.
Important: Disabling all severity levels results in absolutely no message shown. This also disables all severity levels for Clang-Tidy.
Could you try enabling all severity buttons and also the "Show Clang-results" button and (possilby only after a restart of the IDE because of a bug) look if it works now? Only button that should be disabled for testing is the "Show Cppcheck results" button.
I have not configured Clang or the Visual Studio include paths settings in the options. The Clang-Tidy path is taken from the environment variable PATH. I do not know if the includes are searched and found anywhere or simply not necessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I tried everything I could think of.
I also testet it with the cppcheck.sln now and disabled only to show cppcheck result.
Results are looking like:
[C:/Users//Desktop/cppcheck-1.87/lib/ctu.cpp:498] (style) Consider using std::copy algorithm instead of a raw loop. [useStlAlgorithm] [C:\Users\Desktop\cppcheck-1.87\externals\tinyxml\tinyxml2.cpp:757] (warning) Virtual function 'XMLNode' is called from destructor '~XMLNode()' at line 757. Dynamic binding is not used. [virtualCallInConstructor] [C:/Users//Desktop/cppcheck-1.87/lib/preprocessor.cpp:234] (style) Local variable cfg shadows outer function [shadowFunction] [C:/Users//Desktop/cppcheck-1.87/externals/picojson.h:587] (style) The scope of the variable 'hex' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
But if I disable Clang results too I still get the same results. So I guess clang is not working at all.
Totally annoying. Could you share a screenshot what clang results are looking like. Do they have a clang icon (the black winged dragon)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is a screenshot of what it looks like in the GUI.
There is no special icon for the clang-tidy results. But the error id shows that it is a message from clang-tidy. The messages are shown like normal messages with the style, warning, ... icon.
In the dialog for editing project files in the tab "Addons and Tools" the checkbox for "Clang-tidy" has to be enabled. I have used the cppcheck.sln and LLVM 8.0 on a Windows 7 machine.
Hi, thanks for your reply again. To point that out again. I don't want clang-tidy results. But I want clang compiler results. Maybe that is not possible at all? And how can I add the column "Id" in your screenshot. I haven't found any setting for adding this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ah ok, i misunderstood this.
Currently it is not possible to get clang results. Only clang-tidy results.
@danmar worked on that. He disabled the clang analyzer because there is still more to do to get it working. See this commit: https://github.com/danmar/cppcheck/commit/52c121c2232fd347a8c42f2d9b19fc2316c8f1ee
It is still disabled. Not sure how much work is needed to get it running. It definitely needs a build directory set in the project file. If the commit disabling the clang analyzer is reverted i get files with results that only contain errors like this:
error:toomanyerrorsemitted,stoppingnow[clang-diagnostic-error]C:\ProgramFiles(x86)\MicrosoftVisualStudio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xstddef:338:2:error:'auto'returnwithouttrailingreturntype;deducedreturntypesareaC++14extension[clang-diagnostic-error]auto_Unfancy(_Ptrty_Ptr)^C:\ProgramFiles(x86)\MicrosoftVisualStudio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xutility:363:13:error:deducedreturntypesareaC++14extension[clang-diagnostic-error]constexprdecltype(auto)operator()(_Args&&..._Vals)^C:\ProgramFiles(x86)\MicrosoftVisualStudio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xutility:601:17:error:constexprfunction's return type 'void' is not a literal type [clang-diagnostic-error] constexpr void _Adl_verify_range1(const _Iter& _First, const _Sentinel& _Last, true_type) ^C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xutility:608:17: error: constexpr function'sreturntype'void'isnotaliteraltype[clang-diagnostic-error]constexprvoid_Adl_verify_range1(const_Iter&,const_Sentinel&,false_type)^
For the clang analyzer to work i guess all the options must be really correct. It seems to be way more strict than clang-tidy.
The "Id" column can be enabled via the checkbox in the preferences.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am using version 1.87 on windows.
But if I do a cppcheck run over my visual studio solution,
there is not a single clang result found.
And this is very unlikely thats why I assume
there is something not working correctly.
At "Settings -> Clang" I tried with applying the clang path
C:/Program Files/LLVM/bin
as well as leaving it blank.
Also the clang executable path is applied to the environment path variable.
Any ideas why there is no clang result shown?
Also the icon at the toolbar is activated like the other ones to.
When I activated the "Clang-Tidy" radio button at "Projektfile->Addons and Tools" I get clang tidy results interestingly.
Best regards,
gibson
IIRC Clang-Tidy can only be used if a project file (like a .sln file) is used because it needs to know all includes, definitions and so on.
So it might work as intended because you write that it works when you create a project (i guess it is a project using a .sln file?) and enable Clang-Tidy for that project.
I had the same problem (and others too i guess) that it is unclear whether Clang-Tidy is acutally used and if not why it is not used.
Any idea how this can be made more clear or otherwise improved?
Hi, yes I am using a cppcheck project with a given Visual Studio .sln file. Clang-Tidy works as expected. But I am missing any clang compiler messages. If I do a run only with clang results enabled at the toolbar nothing gets found at all. With about 3000 files I would expect dozens of warnings or errors.
I tried it with a project for the cppcheck.sln and it works here.
Important: Disabling all severity levels results in absolutely no message shown. This also disables all severity levels for Clang-Tidy.
Could you try enabling all severity buttons and also the "Show Clang-results" button and (possilby only after a restart of the IDE because of a bug) look if it works now? Only button that should be disabled for testing is the "Show Cppcheck results" button.
I have not configured Clang or the Visual Studio include paths settings in the options. The Clang-Tidy path is taken from the environment variable PATH. I do not know if the includes are searched and found anywhere or simply not necessary.
Hi, I tried everything I could think of.
I also testet it with the cppcheck.sln now and disabled only to show cppcheck result.
Results are looking like:
[C:/Users//Desktop/cppcheck-1.87/lib/ctu.cpp:498] (style) Consider using std::copy algorithm instead of a raw loop. [useStlAlgorithm]
[C:\Users\Desktop\cppcheck-1.87\externals\tinyxml\tinyxml2.cpp:757] (warning) Virtual function 'XMLNode' is called from destructor '~XMLNode()' at line 757. Dynamic binding is not used. [virtualCallInConstructor]
[C:/Users//Desktop/cppcheck-1.87/lib/preprocessor.cpp:234] (style) Local variable cfg shadows outer function [shadowFunction]
[C:/Users//Desktop/cppcheck-1.87/externals/picojson.h:587] (style) The scope of the variable 'hex' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
But if I disable Clang results too I still get the same results. So I guess clang is not working at all.
Totally annoying. Could you share a screenshot what clang results are looking like. Do they have a clang icon (the black winged dragon)?
Here is a screenshot of what it looks like in the GUI.
There is no special icon for the clang-tidy results. But the error id shows that it is a message from clang-tidy. The messages are shown like normal messages with the style, warning, ... icon.
In the dialog for editing project files in the tab "Addons and Tools" the checkbox for "Clang-tidy" has to be enabled. I have used the cppcheck.sln and LLVM 8.0 on a Windows 7 machine.
Last edit: versat 2019-03-25
Hi, thanks for your reply again. To point that out again. I don't want clang-tidy results. But I want clang compiler results. Maybe that is not possible at all? And how can I add the column "Id" in your screenshot. I haven't found any setting for adding this.
Ah ok, i misunderstood this.
Currently it is not possible to get clang results. Only clang-tidy results.
@danmar worked on that. He disabled the clang analyzer because there is still more to do to get it working. See this commit:
https://github.com/danmar/cppcheck/commit/52c121c2232fd347a8c42f2d9b19fc2316c8f1ee
It is still disabled. Not sure how much work is needed to get it running. It definitely needs a build directory set in the project file. If the commit disabling the clang analyzer is reverted i get files with results that only contain errors like this:
For the clang analyzer to work i guess all the options must be really correct. It seems to be way more strict than clang-tidy.
The "Id" column can be enabled via the checkbox in the preferences.