

The UI doesn’t currently support pointing Visual Studio to use a custom clang-tidy.exe, which may be desired in the case of using custom checks, but we’re exploring this as an option going forward. Squiggles show underneath relevant sections of code and hovering over these displays a tooltip with information about the issue, just like with Microsoft Code Analysis warnings. Warnings also display as in-editor squiggles so you can easily view the location and context of discovered issues. cppcoreguidelines, readability, or clang-diagnostic. The “Category” column provides information on the type of warning based on the check prefix, e.g. Running clang-tidy results in itemized warnings populating the Error List, from where you can quickly navigate around your code. toggling squiggle display or background runs) within Tools > Options > Text Editor > C/C++ > Advanced. we do not yet support WSL or remote Linux targeting.Ĭode Analysis can be further configured (e.g. In addition, Clang-Tidy support for CMake configurations only extends to Windows, i.e. We do not currently support configuration via the CMAKE_CLANG_TIDY variable in CMakeLists.txt in the IDE. Starting in Preview 2, you can also configure which tool(s) to use via the enableMicrosoftCodeAnalysis and enableClangTid圜odeAnalysis keys, with in-editor warnings and the Error List updating on file save. In CMake configurations targeting Windows, you can customize checks by specifying the clangTid圜hecks key in the JSON view of CMakeSettings.json, with a string value to be passed to the tool’s –checks option like above. via options such as Checks, HeaderFilterRegex, and SystemHeaders. clang-tidy files, from where the tool attempts to read additional settings and in which you can provide further configuration, e.g. the input to be provided to the –checks option of the tool.įurther configuration is possible via. Rule sets for the MSVC Code Analysis engine are configurable under the “Microsoft” tab, while the “Clang-Tidy” tab allows you to specify which specific clang-tidy checks to enable or disable, i.e. (If you explicitly run Code Analysis without either tool enabled, you’ll simply get a warning returned in the Error List.) In the General tab, you can select which tool(s) to run when running analysis – whether that’s via the Analyze menu, on build, or automatically in the background. We’ve redesigned the Code Analysis section of project Property Pages, allowing you to better configure and define which tool you’re using with each of your projects. Read on to learn about further configuration options. While Code Analysis will run automatically in the background on files opened in the Editor, by default it will not run at build time on all your files. Configuring clang-tidyĬode Analysis defaults to the respective tool as dictated by your platform toolset and compiler: Microsoft Code Analysis if using MSVC (“Visual Studio 2019”) and clang-tidy if using LLVM/clang-cl. For more information about using Clang/LLVM as a compiler in your project, see our past blog posts on Clang/LLVM for MSBuild projects and for CMake projects. Visual Studio 2019 version 16.4 Preview 1 brings a significant improvement to the C++ code analysis experience: native support for clang-tidy, a Clang-based “linter” tool developed by the LLVM Project that delivers a variety of code improvements such as modernization and standards conformance, static analysis, and automatic formatting.

– Removed “Setup: Installing Clang tools” section this is no longer required starting in Visual Studio 2019 version 16.4 Preview 3.
