Skip to content

Commit 21e1687

Browse files
authored
Merge pull request MicrosoftDocs#2696 from MicrosoftDocs/master
2/20/2020 AM Publish
2 parents b9aaaeb + 3c797a7 commit 21e1687

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

docs/code-quality/clang-tidy.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Using Clang-Tidy in Visual Studio
3-
ms.date: 10/04/2019
3+
description: "How to use Clang-Tidy in Visual Studio for Microsoft C++ code analysis."
4+
ms.date: 02/19/2020
45
ms.topic: "conceptual"
56
f1_keywords:
67
- "vs.codeanalysis.clangtidy"
@@ -9,17 +10,25 @@ ms.author: efessler
910
---
1011
# Using Clang-Tidy in Visual Studio
1112

12-
Code Analysis natively supports [Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/) for both MSBuild and CMake projects, whether using Clang or MSVC toolsets. Clang-Tidy checks can run as part of background code analysis, appear as in-editor warnings (squiggles), and display in the Error List.
13+
::: moniker range="<=vs-2017"
1314

14-
In order to use Clang-Tidy, the "C++ Clang tools for Windows" component must be installed via the Visual Studio Installer.
15+
Support for Clang-Tidy requires Visual Studio 2019 version 16.4 or later. To see the documentation, choose Visual Studio 2019 in the documentation version selector.
1516

16-
Clang-Tidy is the default analysis tool when using the LLVM/clang-cl toolset, available in both MSBuild and CMake. You can configure it to run alongside or replace the standard Code Analysis experience when using an MSVC toolset; if using the clang-cl toolset Microsoft Code Analysis will not be available.
17+
::: moniker-end
1718

18-
Clang-Tidy runs after successful compilation; you may need to resolve source code errors to get Clang-Tidy results.
19+
::: moniker range=">=vs-2019"
20+
21+
Code Analysis natively supports [Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/) for both MSBuild and CMake projects, whether using Clang or MSVC toolsets. Clang-Tidy checks can run as part of background code analysis. They appear as in-editor warnings (squiggles), and display in the Error List.
22+
23+
Clang-Tidy support is available starting in Visual Studio 2019 version 16.4. It's included automatically when you choose a C++ workload in the Visual Studio Installer.
24+
25+
Clang-Tidy is the default analysis tool when using the LLVM/clang-cl toolset, available in both MSBuild and CMake. You can configure it when using an MSVC toolset to run alongside, or to replace, the standard Code Analysis experience. If you use the clang-cl toolset, Microsoft Code Analysis is unavailable.
26+
27+
Clang-Tidy runs after successful compilation. You may need to resolve source code errors to get Clang-Tidy results.
1928

2029
## MSBuild
2130

22-
You can configure Clang-Tidy to run as part of both Code Analysis and build under the **Code Analysis** > **General** page in the Project Properties window. Options to configure the tool can be found under the Clang-Tidy sub-menu.
31+
You can configure Clang-Tidy to run as part of both Code Analysis and build under the **Code Analysis** > **General** page in the Project Properties window. Options to configure the tool can be found under the Clang-Tidy submenu.
2332

2433
For more information, see [How to: Set Code Analysis Properties for C/C++ Projects](../code-quality/how-to-set-code-analysis-properties-for-c-cpp-projects.md).
2534

@@ -29,19 +38,21 @@ In CMake projects, you can configure Clang-Tidy checks within `CMakeSettings.jso
2938

3039
- `enableMicrosoftCodeAnalysis`: Enables Microsoft Code Analysis
3140
- `enableClangTidyCodeAnalysis`: Enables Clang-Tidy analysis
32-
- `clangTidyChecks`: Clang-Tidy configuration, specified as a comma-separated list, i.e. checks to be enabled or disabled
41+
- `clangTidyChecks`: Clang-Tidy configuration, specified as a comma-separated list, that is, checks to be enabled or disabled
3342

3443
If neither of the "enable" options are specified, Visual Studio will select the analysis tool matching the Platform Toolset used.
3544

3645
## Warning display
3746

38-
Clang-Tidy runs result in warnings displayed in the Error List and as in-editor squiggles underneath relevant sections of code. Use the "Category" column in the Error List to sort and organize Clang-Tidy warnings. You can configure in-editor warnings by toggling the "Disable Code Analysis Squiggles" setting under **Tools** > **Options**.
47+
Clang-Tidy runs result in warnings displayed in the Error List, and as in-editor squiggles underneath relevant sections of code. Use the "Category" column in the Error List to sort and organize Clang-Tidy warnings. You can configure in-editor warnings by toggling the "Disable Code Analysis Squiggles" setting under **Tools** > **Options**.
3948

4049
## Clang-Tidy configuration
4150

42-
You can configure the checks that clang-tidy runs inside Visual Studio via the **Clang-Tidy Checks** option. This input is provided to the **--checks** argument of the tool. Any further configuration can be included in custom **.clang-tidy** files. See the [Clang-Tidy documentation on LLVM.org](https://clang.llvm.org/extra/clang-tidy/) for more details.
51+
You can configure the checks that clang-tidy runs inside Visual Studio via the **Clang-Tidy Checks** option. This input is provided to the **--checks** argument of the tool. Any further configuration can be included in custom *`.clang-tidy`* files. For more information, see the [Clang-Tidy documentation on LLVM.org](https://clang.llvm.org/extra/clang-tidy/).
4352

4453
## See also
4554

4655
- [Clang/LLVM Support for MSBuild Projects](https://devblogs.microsoft.com/cppblog/clang-llvm-support-for-msbuild-projects/)
4756
- [Clang/LLVM Support for CMake Projects](https://devblogs.microsoft.com/cppblog/visual-studio-cmake-support-clang-llvm-cmake-3-14-vcpkg-and-performance-improvements/)
57+
58+
::: moniker-end

0 commit comments

Comments
 (0)