[PATCH] D23848: Add a clang-tidy Visual Studio extension

Zachary Turner via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 24 13:41:16 PDT 2016


zturner added inline comments.

================
Comment at: CMakeLists.txt:6
@@ -5,2 +5,3 @@
 add_subdirectory(clang-tidy)
+add_subdirectory(clang-tidy-vs)
 endif()
----------------
alexfh wrote:
> Should the plugin be placed inside clang-tidy directory?
I followed the same way that the clang format VS extension uses.  I don't mind to move it, I just did it this way for consistency.

================
Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:81
@@ +80,3 @@
+        [ClangTidyCheck("cert-dcl50-cpp")]
+        public bool CERTDCL50
+        {
----------------
alexfh wrote:
> I hope, this file is generated?
> 
> A way to update this file should be documented.
No, I actually typed this entire file :-/  I don't know of a good way to auto generate it.  We would need a single file, perhaps Yaml or something, consisting of:

1. Category Name
2. Display Name
3. Description
4. clang-tidy built in default value of check.

At that point, we wouldn't even need to generate the file, we could read it at runtime and add the properties dynamically (through the `ICustomTypeDescriptor` interface).

For now though, the way to update the file is to copy / paste one property and change the values accordingly to add a new check.

================
Comment at: clang-tidy-vs/ClangTidy/PropertyFileParser.cs:208
@@ +207,3 @@
+
+                ClangTidyProperties.CheckMapping[] Matches = Props.FindChecksMatching(Check).ToArray();
+                foreach (var Match in Matches)
----------------
alexfh wrote:
> Is the copy needed to avoid aliasing? (i.e. will this break if you iterate over `Props.FindChecksMatching(Check)` instead?)
The copy is not needed to avoid aliasing.  It's fine to iterate over `Props.FindChecksMatching(Check)`.  I wrote it this way because it helps for debugging, as I could just add a watch for `Matches` and view the array in the debugger.


https://reviews.llvm.org/D23848





More information about the cfe-commits mailing list