Clang Diagnostics for Windows
I wrote this extension because I was running into issues with the existing tooling for Visual Studio Code and Clang. This extension exists to support my own workflow and I'm committed to maintain this extension. I'll gladly fix bugs but pull requests should be discussed first. Fork if you want to hack off in another direction.
Display diagnostics from clang in Visual Studio Code.
You need to have the command
Additionally; unless you run Visual Studio Code from within an environment that sets system include search paths you will have to specify these through configuration. For example, Microsoft Visual C++ 2015 compiler (cl.exe) configuration is as follows:
System include search paths never yield diagnostics.
How do I figure out what paths to include?
These are system internals and not something which I find to be well documented. However, it's relativly simple to reverse engineer.
Review the path information and set up include search paths accordingly.
For a comprehensive list of warnings that clang generates, see this reference.
The following options are hardcoded and shouldn't be changed.
Header files are treated as C++ files, regardless of their extension. Header files passed directly to clang for analysis disable
There's no way to distinguish what the cause of a Clang fatal error is, as such, these are shown in the output window. If the error didn't yield any diagnostic for the analyzed file the output window is shown with the relevant output from Clang directly. Hopefully this will make it easier to understand when Clang needs to be configured to work properly.
Analysis for multiple documents in parallel is done when configuration is updated. This can result in output getting lost in the output window. This only happens when the configuration is changed while more than 1 document with the
Changed the naming of settings as follows
Added the following settings (specific to C and C++ files respectively)
Feature: Added support for expansion of environment variables in settings
0.0.7 - 0.0.8
Bugfix: Track where diagnostics goes to prevent stale diagnostics from lingering.
Feature: Diagnostics from files other than the main file passed to Clang are now shown.
Bugfix: Fixed nasty bug where inner loop variable shadowed outer loop variable and caused infinite loop.
Bugfix: Clang diagnostics parse error.
Bugfix: workspace relative include search paths.
Bugfix: support multiple source range info hints for the same diagnostic.