Add a clang-tidy visual studio extension.
authorZachary Turner <zturner@google.com>
Wed, 7 Sep 2016 18:28:55 +0000 (18:28 +0000)
committerZachary Turner <zturner@google.com>
Wed, 7 Sep 2016 18:28:55 +0000 (18:28 +0000)
For now this only adds the UI necessary to configure clang-tidy
settings graphically, and it enables reading in and saving out
of .clang-tidy files.  It does not actually run clang-tidy on
any source files yet.

Differential Revision: https://reviews.llvm.org/D23848

llvm-svn: 280840

38 files changed:
clang-tools-extra/CMakeLists.txt
clang-tools-extra/clang-tidy-vs/.gitignore [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/CMakeLists.txt [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy.sln [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/CategoryVerb.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/CheckDatabase.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/CheckTree.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidy.csproj [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidy.vsct [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyCheckAttribute.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyConfigParser.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyConfigurationPage.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPackage.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyProperties.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.Designer.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.resx [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyComponent.Designer.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyComponent.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyConverter.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyDescriptor.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/ForwardingPropertyDescriptor.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/GlobalSuppressions.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Guids.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/PkgCmdID.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Properties/AssemblyInfo.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Resources.Designer.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Resources.resx [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Images_32bit.bmp [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Package.ico [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/Utility.cs [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/VSPackage.resx [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/license.txt [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/packages.config [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/ClangTidy/source.extension.vsixmanifest [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/README.txt [new file with mode: 0644]
clang-tools-extra/clang-tidy-vs/source.extension.vsixmanifest.in [new file with mode: 0644]

index db11305..bdbd5ab 100644 (file)
@@ -4,6 +4,7 @@ add_subdirectory(clang-reorder-fields)
 add_subdirectory(modularize)
 if(CLANG_ENABLE_STATIC_ANALYZER)
 add_subdirectory(clang-tidy)
+add_subdirectory(clang-tidy-vs)
 endif()
 
 add_subdirectory(clang-query)
diff --git a/clang-tools-extra/clang-tidy-vs/.gitignore b/clang-tools-extra/clang-tidy-vs/.gitignore
new file mode 100644 (file)
index 0000000..2b0f3e7
--- /dev/null
@@ -0,0 +1,7 @@
+obj/\r
+bin/\r
+.vs/\r
+Key.snk\r
+clang-tidy.exe\r
+packages/\r
+*.csproj.user\r
diff --git a/clang-tools-extra/clang-tidy-vs/CMakeLists.txt b/clang-tools-extra/clang-tidy-vs/CMakeLists.txt
new file mode 100644 (file)
index 0000000..96381bd
--- /dev/null
@@ -0,0 +1,28 @@
+option(BUILD_CLANG_TIDY_VS_PLUGIN "Build clang-tidy VS plugin" OFF)
+if (BUILD_CLANG_TIDY_VS_PLUGIN)
+  add_custom_target(clang_tidy_exe_for_vsix
+      ${CMAKE_COMMAND} -E copy_if_different
+      "${LLVM_TOOLS_BINARY_DIR}/clang-tidy.exe"
+      "${CMAKE_CURRENT_SOURCE_DIR}/ClangTidy/clang-tidy.exe"
+      DEPENDS clang-tidy)
+
+  add_custom_target(clang_tidy_license
+      ${CMAKE_COMMAND} -E copy_if_different
+      "${CLANG_SOURCE_DIR}/LICENSE.TXT"
+      "${CMAKE_CURRENT_SOURCE_DIR}/ClangTidy/license.txt")
+
+  if (NOT CLANG_TIDY_VS_VERSION)
+    set(CLANG_TIDY_VS_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
+  endif()
+
+  configure_file("source.extension.vsixmanifest.in"
+      "${CMAKE_CURRENT_SOURCE_DIR}/ClangTidy/source.extension.vsixmanifest")
+
+  add_custom_target(clang_tidy_vsix ALL
+      devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangTidy.sln" /Build Release
+      DEPENDS clang_tidy_exe_for_vsix "${CMAKE_CURRENT_SOURCE_DIR}/ClangTidy/source.extension.vsixmanifest"
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different
+      "${CMAKE_CURRENT_SOURCE_DIR}/ClangTidy/bin/Release/ClangTidy.vsix"
+      "${LLVM_TOOLS_BINARY_DIR}/ClangTidy.vsix"
+      DEPENDS clang_tidy_exe_for_vsix clang_tidy_license)
+endif()
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy.sln b/clang-tools-extra/clang-tidy-vs/ClangTidy.sln
new file mode 100644 (file)
index 0000000..345eb83
--- /dev/null
@@ -0,0 +1,22 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 14\r
+VisualStudioVersion = 14.0.25123.0\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClangTidy", "ClangTidy\ClangTidy.csproj", "{BE261DA1-36C6-449A-95C5-4653A549170A}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Any CPU = Debug|Any CPU\r
+               Release|Any CPU = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {BE261DA1-36C6-449A-95C5-4653A549170A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {BE261DA1-36C6-449A-95C5-4653A549170A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {BE261DA1-36C6-449A-95C5-4653A549170A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {BE261DA1-36C6-449A-95C5-4653A549170A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/CategoryVerb.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/CategoryVerb.cs
new file mode 100644 (file)
index 0000000..ef07a89
--- /dev/null
@@ -0,0 +1,70 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Globalization;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    /// <summary>\r
+    /// Allows entire categories of properties to be enabled, disabled, or inherited\r
+    /// in one fell swoop.  We add properties to each category with the value being\r
+    /// this enum, and when the value is selected, we use reflection to find all other\r
+    /// properties in the same category and perform the corresponding action.\r
+    /// </summary>\r
+    public enum CategoryVerb\r
+    {\r
+        None,\r
+        Disable,\r
+        Enable,\r
+        Inherit\r
+    }\r
+\r
+    public class CategoryVerbConverter : EnumConverter\r
+    {\r
+        public CategoryVerbConverter() : base(typeof(CategoryVerb))\r
+        {\r
+        }\r
+\r
+        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\r
+        {\r
+            if (value is string)\r
+            {\r
+                switch ((string)value)\r
+                {\r
+                    case "Disable Category":\r
+                        return CategoryVerb.Disable;\r
+                    case "Enable Category":\r
+                        return CategoryVerb.Enable;\r
+                    case "Inherit Category":\r
+                        return CategoryVerb.Inherit;\r
+                    case "":\r
+                        return CategoryVerb.None;\r
+                }\r
+            }\r
+            return base.ConvertFrom(context, culture, value);\r
+        }\r
+\r
+        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)\r
+        {\r
+            if (value is CategoryVerb && destinationType == typeof(string))\r
+            {\r
+                switch ((CategoryVerb)value)\r
+                {\r
+                    case CategoryVerb.Disable:\r
+                        return "Disable Category";\r
+                    case CategoryVerb.Enable:\r
+                        return "Enable Category";\r
+                    case CategoryVerb.Inherit:\r
+                        return "Inherit Category";\r
+                    case CategoryVerb.None:\r
+                        return String.Empty;\r
+                }\r
+            }\r
+\r
+            return base.ConvertTo(context, culture, value, destinationType);\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/CheckDatabase.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/CheckDatabase.cs
new file mode 100644 (file)
index 0000000..3cf8efc
--- /dev/null
@@ -0,0 +1,67 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.IO;\r
+using System.Linq;\r
+using System.Text;\r
+using YamlDotNet.Serialization;\r
+using YamlDotNet.Serialization.NamingConventions;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    public class CheckInfo\r
+    {\r
+        [YamlAlias("Name")]\r
+        public string Name { get; set; }\r
+\r
+        [YamlAlias("Label")]\r
+        public string Label { get; set; }\r
+\r
+        [YamlAlias("Description")]\r
+        public string Desc { get; set; }\r
+\r
+        [YamlAlias("Category")]\r
+        public string Category { get; set; }\r
+    }\r
+\r
+    /// <summary>\r
+    /// Reads the list of checks from Yaml and builds a description of each one.\r
+    /// This list of checks is then used by the PropertyGrid to determine what\r
+    /// items to display.\r
+    /// </summary>\r
+    public static class CheckDatabase\r
+    {\r
+        static CheckInfo[] Checks_ = null;\r
+\r
+        class CheckRoot\r
+        {\r
+            [YamlAlias("Checks")]\r
+            public CheckInfo[] Checks { get; set; }\r
+        }\r
+\r
+        static CheckDatabase()\r
+        {\r
+            using (StringReader Reader = new StringReader(Resources.ClangTidyChecks))\r
+            {\r
+                Deserializer D = new Deserializer(namingConvention: new PascalCaseNamingConvention());\r
+                var Root = D.Deserialize<CheckRoot>(Reader);\r
+                Checks_ = Root.Checks;\r
+\r
+                HashSet<string> Names = new HashSet<string>();\r
+                foreach (var Check in Checks_)\r
+                {\r
+                    if (Names.Contains(Check.Name))\r
+                        throw new ArgumentException(String.Format("Check {0} exists more than once!", Check.Name));\r
+                    Names.Add(Check.Name);\r
+                }\r
+            }\r
+        }\r
+\r
+        public static IEnumerable<CheckInfo> Checks\r
+        {\r
+            get\r
+            {\r
+                return Checks_;\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/CheckTree.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/CheckTree.cs
new file mode 100644 (file)
index 0000000..ab746fe
--- /dev/null
@@ -0,0 +1,272 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Text;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    /// <summary>\r
+    /// CheckTree is used to group checks into categories and subcategories.  For\r
+    /// example, given the following list of checks:\r
+    /// \r
+    ///   llvm-include-order\r
+    ///   llvm-namespace-comment\r
+    ///   llvm-twine-local\r
+    ///   llvm-header-guard\r
+    ///   google-runtime-member-string-references\r
+    ///   google-runtime-int\r
+    ///   google-readability-namespace-comments\r
+    ///   \r
+    /// the corresponding CheckTree would look like this:\r
+    /// \r
+    ///   llvm\r
+    ///     include-order\r
+    ///     namespace-comment\r
+    ///     twine-local\r
+    ///     header-guard\r
+    ///   google\r
+    ///     runtime\r
+    ///       member-string-references\r
+    ///       int\r
+    ///     readability\r
+    ///       namespace-comments\r
+    ///       redundant-smartptr-get\r
+    ///       \r
+    /// This is useful when serializing a set of options out to a .clang-tidy file,\r
+    /// because we need to decide the most efficient way to serialize the sequence\r
+    /// of check commands, when to use wildcards, etc.  For example, if everything\r
+    /// under google is inherited, we can simply leave that entry out entirely from\r
+    /// the .clang-tidy file.  On the other hand, if anything is inherited, we *must\r
+    /// not* add or remove google-* by wildcard because that, by definition, means\r
+    /// the property is no longer inherited.  When we can categorize the checks into\r
+    /// groups and subgroups like this, it is possible to efficiently serialize to\r
+    /// a minimal representative .clang-tidy file.\r
+    /// </summary>\r
+\r
+    public abstract class CheckTreeNode\r
+    {\r
+        private string Name_;\r
+        private CheckTreeNode Parent_;\r
+\r
+        protected CheckTreeNode(string Name, CheckTreeNode Parent)\r
+        {\r
+            Name_ = Name;\r
+            Parent_ = Parent;\r
+        }\r
+\r
+        public string Path\r
+        {\r
+            get\r
+            {\r
+                if (Parent_ == null)\r
+                    return null;\r
+                string ParentPath = Parent_.Path;\r
+                if (ParentPath == null)\r
+                    return Name_;\r
+                return ParentPath + "-" + Name_;\r
+            }\r
+        }\r
+\r
+        public string Name\r
+        {\r
+            get\r
+            {\r
+                return Name_;\r
+            }\r
+        }\r
+\r
+\r
+        public abstract int CountChecks { get; }\r
+        public abstract int CountExplicitlyDisabledChecks { get; }\r
+        public abstract int CountExplicitlyEnabledChecks { get; }\r
+        public abstract int CountInheritedChecks { get; }\r
+    }\r
+\r
+    public class CheckTree : CheckTreeNode\r
+    {\r
+        private Dictionary<string, CheckTreeNode> Children_ = new Dictionary<string, CheckTreeNode>();\r
+        public CheckTree()\r
+            : base(null, null)\r
+        {\r
+\r
+        }\r
+\r
+        private CheckTree(string Name, CheckTree Parent)\r
+            : base(Name, Parent)\r
+        {\r
+        }\r
+\r
+        private void AddLeaf(string Name, DynamicPropertyDescriptor<bool> Property)\r
+        {\r
+            Children_[Name] = new CheckLeaf(Name, this, Property);\r
+        }\r
+\r
+        private CheckTree AddOrCreateSubgroup(string Name)\r
+        {\r
+            CheckTreeNode Subgroup = null;\r
+            if (Children_.TryGetValue(Name, out Subgroup))\r
+            {\r
+                System.Diagnostics.Debug.Assert(Subgroup is CheckTree);\r
+                return (CheckTree)Subgroup;\r
+            }\r
+\r
+            CheckTree SG = new CheckTree(Name, this);\r
+            Children_[Name] = SG;\r
+            return SG;\r
+        }\r
+\r
+        public static CheckTree Build(ClangTidyProperties Config)\r
+        {\r
+            // Since some check names contain dashes in them, it doesn't make sense to\r
+            // simply split all check names by dash and construct a huge tree.  For\r
+            // example, in the check called google-runtime-member-string-references,\r
+            // we don't need each of those to be a different subgroup.  So instead we\r
+            // explicitly specify the common breaking points at which a user might want\r
+            // to use a -* and everything else falls as a leaf under one of these\r
+            // categories.\r
+            // FIXME: This should be configurable without recompilation\r
+            CheckTree Root = new CheckTree();\r
+            string[][] Groups = new string[][] {\r
+                new string[] {"boost"},\r
+                new string[] {"cert"},\r
+                new string[] {"clang", "diagnostic"},\r
+                new string[] {"cppcoreguidelines", "interfaces"},\r
+                new string[] {"cppcoreguidelines", "pro", "bounds"},\r
+                new string[] {"cppcoreguidelines", "pro", "type"},\r
+                new string[] {"google", "build"},\r
+                new string[] {"google", "readability"},\r
+                new string[] {"google", "runtime"},\r
+                new string[] {"llvm"},\r
+                new string[] {"misc"},\r
+            };\r
+\r
+            foreach (string[] Group in Groups)\r
+            {\r
+                CheckTree Subgroup = Root;\r
+                foreach (string Component in Group)\r
+                    Subgroup = Subgroup.AddOrCreateSubgroup(Component);\r
+            }\r
+\r
+            var Props = Config.GetProperties()\r
+                              .Cast<PropertyDescriptor>()\r
+                              .OfType<DynamicPropertyDescriptor<bool>>()\r
+                              .Where(x => x.Attributes.OfType<ClangTidyCheckAttribute>().Count() > 0)\r
+                              .Select(x => new KeyValuePair<DynamicPropertyDescriptor<bool>, string>(\r
+                                            x, x.Attributes.OfType<ClangTidyCheckAttribute>().First().CheckName));\r
+            var PropArray = Props.ToArray();\r
+            foreach (var CheckInfo in PropArray)\r
+            {\r
+                string LeafName = null;\r
+                CheckTree Tree = Root.LocateCheckLeafGroup(CheckInfo.Value, out LeafName);\r
+                Tree.AddLeaf(LeafName, CheckInfo.Key);\r
+            }\r
+            return Root;\r
+        }\r
+\r
+        private CheckTree LocateCheckLeafGroup(string Check, out string LeafName)\r
+        {\r
+            string[] Components = Check.Split('-');\r
+            string FirstComponent = Components.FirstOrDefault();\r
+            if (FirstComponent == null)\r
+            {\r
+                LeafName = Check;\r
+                return this;\r
+            }\r
+\r
+            CheckTreeNode Subgroup = null;\r
+            if (!Children_.TryGetValue(FirstComponent, out Subgroup))\r
+            {\r
+                LeafName = Check;\r
+                return this;\r
+            }\r
+            System.Diagnostics.Debug.Assert(Subgroup is CheckTree);\r
+            CheckTree Child = (CheckTree)Subgroup;\r
+            string ChildName = Check.Substring(FirstComponent.Length + 1);\r
+            return Child.LocateCheckLeafGroup(ChildName, out LeafName);\r
+        }\r
+\r
+        public override int CountChecks\r
+        {\r
+            get\r
+            {\r
+                return Children_.Aggregate(0, (X, V) => { return X + V.Value.CountChecks; });\r
+            }\r
+        }\r
+\r
+        public override int CountExplicitlyDisabledChecks\r
+        {\r
+            get\r
+            {\r
+                return Children_.Aggregate(0, (X, V) => { return X + V.Value.CountExplicitlyDisabledChecks; });\r
+            }\r
+        }\r
+\r
+        public override int CountExplicitlyEnabledChecks\r
+        {\r
+            get\r
+            {\r
+                return Children_.Aggregate(0, (X, V) => { return X + V.Value.CountExplicitlyEnabledChecks; });\r
+            }\r
+        }\r
+        public override int CountInheritedChecks\r
+        {\r
+            get\r
+            {\r
+                return Children_.Aggregate(0, (X, V) => { return X + V.Value.CountInheritedChecks; });\r
+            }\r
+        }\r
+\r
+        public IDictionary<string, CheckTreeNode> Children\r
+        {\r
+            get { return Children_; }\r
+        }\r
+    }\r
+\r
+    public class CheckLeaf : CheckTreeNode\r
+    {\r
+        private DynamicPropertyDescriptor<bool> Property_;\r
+\r
+        public CheckLeaf(string Name, CheckTree Parent, DynamicPropertyDescriptor<bool> Property)\r
+            : base(Name, Parent)\r
+        {\r
+            Property_ = Property;\r
+        }\r
+\r
+        public override int CountChecks\r
+        {\r
+            get\r
+            {\r
+                return 1;\r
+            }\r
+        }\r
+\r
+        public override int CountExplicitlyDisabledChecks\r
+        {\r
+            get\r
+            {\r
+                if (Property_.IsInheriting)\r
+                    return 0;\r
+                return (bool)Property_.GetValue(null) ? 0 : 1;\r
+            }\r
+        }\r
+\r
+        public override int CountExplicitlyEnabledChecks\r
+        {\r
+            get\r
+            {\r
+                if (Property_.IsInheriting)\r
+                    return 0;\r
+                return (bool)Property_.GetValue(null) ? 1 : 0;\r
+            }\r
+        }\r
+\r
+        public override int CountInheritedChecks\r
+        {\r
+            get\r
+            {\r
+                return (Property_.IsInheriting) ? 1 : 0;\r
+            }\r
+        }\r
+\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidy.csproj b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidy.csproj
new file mode 100644 (file)
index 0000000..32fc2d7
--- /dev/null
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">\r
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{BE261DA1-36C6-449A-95C5-4653A549170A}</ProjectGuid>\r
+    <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r
+    <OutputType>Library</OutputType>\r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>LLVM.ClangTidy</RootNamespace>\r
+    <AssemblyName>ClangTidy</AssemblyName>\r
+    <SignAssembly>true</SignAssembly>\r
+    <AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>\r
+    <FileUpgradeFlags>\r
+    </FileUpgradeFlags>\r
+    <UpgradeBackupLocation>\r
+    </UpgradeBackupLocation>\r
+    <OldToolsVersion>4.0</OldToolsVersion>\r
+    <PublishUrl>publish\</PublishUrl>\r
+    <Install>true</Install>\r
+    <InstallFrom>Disk</InstallFrom>\r
+    <UpdateEnabled>false</UpdateEnabled>\r
+    <UpdateMode>Foreground</UpdateMode>\r
+    <UpdateInterval>7</UpdateInterval>\r
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r
+    <UpdatePeriodically>false</UpdatePeriodically>\r
+    <UpdateRequired>false</UpdateRequired>\r
+    <MapFileExtensions>true</MapFileExtensions>\r
+    <ApplicationRevision>0</ApplicationRevision>\r
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r
+    <IsWebBootstrapper>false</IsWebBootstrapper>\r
+    <UseApplicationTrust>false</UseApplicationTrust>\r
+    <BootstrapperEnabled>true</BootstrapperEnabled>\r
+    <TargetFrameworkProfile />\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <Optimize>false</Optimize>\r
+    <OutputPath>bin\Debug\</OutputPath>\r
+    <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>0</WarningLevel>\r
+    <Prefer32Bit>false</Prefer32Bit>\r
+    <PlatformTarget>AnyCPU</PlatformTarget>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <Optimize>true</Optimize>\r
+    <OutputPath>bin\Release\</OutputPath>\r
+    <DefineConstants>TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
+    <Prefer32Bit>false</Prefer32Bit>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <Reference Include="Microsoft.CSharp" />\r
+    <Reference Include="Microsoft.VisualStudio.CoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
+    <Reference Include="Microsoft.VisualStudio.Editor, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
+    <Reference Include="Microsoft.VisualStudio.OLE.Interop" />\r
+    <Reference Include="Microsoft.VisualStudio.Settings.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86" />\r
+    <Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Immutable.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Interop" />\r
+    <Reference Include="Microsoft.VisualStudio.TextManager.Interop" />\r
+    <Reference Include="Microsoft.VisualStudio.TextManager.Interop" />\r
+    <Reference Include="Microsoft.VisualStudio.Utilities, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
+    <Reference Include="System" />\r
+    <Reference Include="System.Core" />\r
+    <Reference Include="System.Data" />\r
+    <Reference Include="System.Design" />\r
+    <Reference Include="System.Drawing" />\r
+    <Reference Include="System.Windows.Forms" />\r
+    <Reference Include="System.Xml" />\r
+    <Reference Include="System.Xml.Linq" />\r
+    <Reference Include="YamlDotNet, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\YamlDotNet.3.3.0\lib\net35\YamlDotNet.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+    <Reference Include="YamlDotNet.Dynamic, Version=3.2.0.0, Culture=neutral, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\YamlDotNet.Dynamic.3.2.3\lib\net40\YamlDotNet.Dynamic.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <COMReference Include="EnvDTE">\r
+      <Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>\r
+      <VersionMajor>8</VersionMajor>\r
+      <VersionMinor>0</VersionMinor>\r
+      <Lcid>0</Lcid>\r
+      <WrapperTool>primary</WrapperTool>\r
+      <Isolated>False</Isolated>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </COMReference>\r
+    <COMReference Include="EnvDTE100">\r
+      <Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>\r
+      <VersionMajor>10</VersionMajor>\r
+      <VersionMinor>0</VersionMinor>\r
+      <Lcid>0</Lcid>\r
+      <WrapperTool>primary</WrapperTool>\r
+      <Isolated>False</Isolated>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </COMReference>\r
+    <COMReference Include="EnvDTE80">\r
+      <Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>\r
+      <VersionMajor>8</VersionMajor>\r
+      <VersionMinor>0</VersionMinor>\r
+      <Lcid>0</Lcid>\r
+      <WrapperTool>primary</WrapperTool>\r
+      <Isolated>False</Isolated>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </COMReference>\r
+    <COMReference Include="EnvDTE90">\r
+      <Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>\r
+      <VersionMajor>9</VersionMajor>\r
+      <VersionMinor>0</VersionMinor>\r
+      <Lcid>0</Lcid>\r
+      <WrapperTool>primary</WrapperTool>\r
+      <Isolated>False</Isolated>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </COMReference>\r
+    <COMReference Include="Microsoft.VisualStudio.CommandBars">\r
+      <Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>\r
+      <VersionMajor>8</VersionMajor>\r
+      <VersionMinor>0</VersionMinor>\r
+      <Lcid>0</Lcid>\r
+      <WrapperTool>primary</WrapperTool>\r
+      <Isolated>False</Isolated>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </COMReference>\r
+    <COMReference Include="stdole">\r
+      <Guid>{00020430-0000-0000-C000-000000000046}</Guid>\r
+      <VersionMajor>2</VersionMajor>\r
+      <VersionMinor>0</VersionMinor>\r
+      <Lcid>0</Lcid>\r
+      <WrapperTool>primary</WrapperTool>\r
+      <Isolated>False</Isolated>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </COMReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Compile Include="CategoryVerb.cs" />\r
+    <Compile Include="CheckDatabase.cs" />\r
+    <Compile Include="CheckTree.cs" />\r
+    <Compile Include="ClangTidyCheckAttribute.cs" />\r
+    <Compile Include="ClangTidyConfigurationPage.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
+    <Compile Include="ClangTidyProperties.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
+    <Compile Include="DynamicPropertyConverter.cs" />\r
+    <Compile Include="DynamicPropertyDescriptor.cs" />\r
+    <Compile Include="ForwardingPropertyDescriptor.cs" />\r
+    <Compile Include="Guids.cs" />\r
+    <Compile Include="DynamicPropertyComponent.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
+    <Compile Include="DynamicPropertyComponent.Designer.cs" />\r
+    <Compile Include="ClangTidyConfigParser.cs" />\r
+    <Compile Include="Resources.Designer.cs">\r
+      <AutoGen>True</AutoGen>\r
+      <DesignTime>True</DesignTime>\r
+      <DependentUpon>Resources.resx</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="GlobalSuppressions.cs" />\r
+    <Compile Include="ClangTidyPackage.cs" />\r
+    <Compile Include="Properties\AssemblyInfo.cs" />\r
+    <Compile Include="PkgCmdID.cs" />\r
+    <Compile Include="ClangTidyPropertyGrid.cs">\r
+      <SubType>UserControl</SubType>\r
+    </Compile>\r
+    <Compile Include="ClangTidyPropertyGrid.Designer.cs">\r
+      <DependentUpon>ClangTidyPropertyGrid.cs</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="Utility.cs" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <EmbeddedResource Include="Resources.resx">\r
+      <Generator>ResXFileCodeGenerator</Generator>\r
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\r
+      <SubType>Designer</SubType>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="ClangTidyPropertyGrid.resx">\r
+      <DependentUpon>ClangTidyPropertyGrid.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="VSPackage.resx">\r
+      <MergeWithCTO>true</MergeWithCTO>\r
+      <ManifestResourceName>VSPackage</ManifestResourceName>\r
+    </EmbeddedResource>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="Key.snk" />\r
+    <None Include="packages.config" />\r
+    <None Include="Resources\ClangTidyChecks.yaml" />\r
+    <None Include="source.extension.vsixmanifest">\r
+      <SubType>Designer</SubType>\r
+    </None>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <VSCTCompile Include="ClangTidy.vsct">\r
+      <ResourceName>Menus.ctmenu</ResourceName>\r
+      <SubType>Designer</SubType>\r
+    </VSCTCompile>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="Resources\Images_32bit.bmp" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Content Include="clang-tidy.exe">\r
+      <IncludeInVSIX>true</IncludeInVSIX>\r
+    </Content>\r
+    <Content Include="license.txt">\r
+      <IncludeInVSIX>true</IncludeInVSIX>\r
+    </Content>\r
+    <Content Include="Resources\Package.ico" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">\r
+      <Visible>False</Visible>\r
+      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>\r
+      <Install>true</Install>\r
+    </BootstrapperPackage>\r
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">\r
+      <Visible>False</Visible>\r
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>\r
+      <Install>false</Install>\r
+    </BootstrapperPackage>\r
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">\r
+      <Visible>False</Visible>\r
+      <ProductName>.NET Framework 3.5 SP1</ProductName>\r
+      <Install>false</Install>\r
+    </BootstrapperPackage>\r
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">\r
+      <Visible>False</Visible>\r
+      <ProductName>Windows Installer 4.5</ProductName>\r
+      <Install>true</Install>\r
+    </BootstrapperPackage>\r
+  </ItemGroup>\r
+  <PropertyGroup>\r
+    <UseCodebase>true</UseCodebase>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>\r
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
+  <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />\r
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" Condition="false" />\r
+  <PropertyGroup>\r
+    <PreBuildEvent>if not exist $(ProjectDir)Key.snk ("$(SDKToolsPath)\sn.exe" -k $(ProjectDir)Key.snk)</PreBuildEvent>\r
+  </PropertyGroup>\r
+  <Target Name="BeforeBuild">\r
+    <Exec ContinueOnError="false" Command="&quot;..\packages\Brutal.Dev.StrongNameSigner.1.8.0\tools\StrongNameSigner.Console.exe&quot; -in &quot;..\packages&quot;" />\r
+  </Target>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+</Project>
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidy.vsct b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidy.vsct
new file mode 100644 (file)
index 0000000..8bdaeec
--- /dev/null
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">\r
+\r
+  <!--  This is the file that defines the actual layout and type of the commands.\r
+        It is divided in different sections (e.g. command definition, command\r
+        placement, ...), with each defining a specific set of properties.\r
+        See the comment before each section for more details about how to\r
+        use it. -->\r
+\r
+  <!--  The VSCT compiler (the tool that translates this file into the binary \r
+        format that VisualStudio will consume) has the ability to run a preprocessor \r
+        on the vsct file; this preprocessor is (usually) the C++ preprocessor, so \r
+        it is possible to define includes and macros with the same syntax used \r
+        in C++ files. Using this ability of the compiler here, we include some files \r
+        defining some of the constants that we will use inside the file. -->\r
+\r
+  <!--This is the file that defines the IDs for all the commands exposed by VisualStudio. -->\r
+  <Extern href="stdidcmd.h"/>\r
+\r
+  <!--This header contains the command ids for the menus provided by the shell. -->\r
+  <Extern href="vsshlids.h"/>\r
+\r
+\r
+\r
+\r
+  <!--The Commands section is where we the commands, menus and menu groups are defined.\r
+      This section uses a Guid to identify the package that provides the command defined inside it. -->\r
+  <Commands package="guidClangTidyPkg">\r
+    <!-- Inside this section we have different sub-sections: one for the menus, another  \r
+    for the menu groups, one for the buttons (the actual commands), one for the combos \r
+    and the last one for the bitmaps used. Each element is identified by a command id that  \r
+    is a unique pair of guid and numeric identifier; the guid part of the identifier is usually  \r
+    called "command set" and is used to group different command inside a logically related  \r
+    group; your package should define its own command set in order to avoid collisions  \r
+    with command ids defined by other packages. -->\r
+\r
+    \r
+    <!-- In this section you can define new menu groups. A menu group is a container for \r
+         other menus or buttons (commands); from a visual point of view you can see the \r
+         group as the part of a menu contained between two lines. The parent of a group \r
+         must be a menu. -->\r
+    <Groups>\r
+\r
+      <Group guid="guidClangTidyCmdSet" id="MyMenuGroup" priority="0x0600">\r
+        <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>\r
+      </Group>\r
+      \r
+\r
+\r
+    </Groups>\r
+    \r
+    <!--Buttons section. -->\r
+    <!--This section defines the elements the user can interact with, like a menu command or a button \r
+        or combo box in a toolbar. -->\r
+    <Buttons>\r
+      <!--To define a menu group you have to specify its ID, the parent menu and its display priority. \r
+          The command is visible and enabled by default. If you need to change the visibility, status, etc, you can use\r
+          the CommandFlag node.\r
+          You can add more than one CommandFlag node e.g.:\r
+              <CommandFlag>DefaultInvisible</CommandFlag>\r
+              <CommandFlag>DynamicVisibility</CommandFlag>\r
+          If you do not want an image next to your command, remove the Icon node /> -->\r
+\r
+      <Button guid="guidClangTidyCmdSet" id="cmdidClangTidy" priority="0x0100" type="Button">\r
+        <Parent guid="guidClangTidyCmdSet" id="MyMenuGroup" />\r
+        <Icon guid="guidImages" id="bmpPic1" />\r
+        <Strings>\r
+          <ButtonText>ClangTidy</ButtonText>\r
+        </Strings>\r
+      </Button>\r
+\r
+\r
+\r
+    </Buttons>\r
+   \r
+    <!--The bitmaps section is used to define the bitmaps that are used for the commands.-->\r
+    <Bitmaps>\r
+      <!--  The bitmap id is defined in a way that is a little bit different from the others: \r
+            the declaration starts with a guid for the bitmap strip, then there is the resource id of the \r
+            bitmap strip containing the bitmaps and then there are the numeric ids of the elements used \r
+            inside a button definition. An important aspect of this declaration is that the element id \r
+            must be the actual index (1-based) of the bitmap inside the bitmap strip. -->\r
+      <Bitmap guid="guidImages" href="Resources\Images_32bit.bmp" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows"/>\r
+      \r
+    </Bitmaps>\r
\r
+  </Commands>\r
+\r
+\r
+  <KeyBindings>\r
+    <KeyBinding guid="guidClangTidyCmdSet" id="cmdidClangTidy" editor="guidTextEditor" key1="R" mod1="Control" key2="T" mod2="Control"/>\r
+  </KeyBindings>\r
+\r
+\r
+\r
+  <Symbols>\r
+    <!-- This is the package guid. -->\r
+    <GuidSymbol name="guidClangTidyPkg" value="{AE4956BE-3DB8-430E-BBAB-7E2E9A014E9C}" />\r
+    \r
+    <!-- This is the guid used to group the menu commands together -->\r
+    <GuidSymbol name="guidClangTidyCmdSet" value="{9E0F0493-6493-46DE-AEE1-ACD8F60F265E}">\r
+      <IDSymbol name="MyMenuGroup" value="0x1020" />\r
+      <IDSymbol name="cmdidClangTidy" value="0x0100" />\r
+    </GuidSymbol>\r
+\r
+    <GuidSymbol name="guidTextEditor" value="{E10FAD35-7FB8-4991-A269-EF88F12166C9}" />\r
+\r
+\r
+    <GuidSymbol name="guidImages" value="{942F126F-942D-428A-84B4-4AC7C523D0B2}" >\r
+      <IDSymbol name="bmpPic1" value="1" />\r
+      <IDSymbol name="bmpPic2" value="2" />\r
+      <IDSymbol name="bmpPicSearch" value="3" />\r
+      <IDSymbol name="bmpPicX" value="4" />\r
+      <IDSymbol name="bmpPicArrows" value="5" />\r
+    </GuidSymbol>\r
+  </Symbols>\r
+\r
+</CommandTable>\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyCheckAttribute.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyCheckAttribute.cs
new file mode 100644 (file)
index 0000000..59234d7
--- /dev/null
@@ -0,0 +1,22 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    public class ClangTidyCheckAttribute : Attribute\r
+    {\r
+        private string CheckName_;\r
+        public ClangTidyCheckAttribute(string CheckName)\r
+        {\r
+            this.CheckName_ = CheckName;\r
+        }\r
+\r
+        public string CheckName\r
+        {\r
+            get { return CheckName_; }\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyConfigParser.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyConfigParser.cs
new file mode 100644 (file)
index 0000000..db5b055
--- /dev/null
@@ -0,0 +1,214 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.IO;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+using YamlDotNet.Serialization;\r
+using YamlDotNet.Serialization.NamingConventions;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    static class ClangTidyConfigParser\r
+    {\r
+        public class CheckOption\r
+        {\r
+            [YamlAlias("key")]\r
+            public string Key { get; set; }\r
+\r
+            [YamlAlias("value")]\r
+            public string Value { get; set; }\r
+        }\r
+        public class ClangTidyYaml\r
+        {\r
+            [YamlAlias("Checks")]\r
+            public string Checks { get; set; }\r
+\r
+            [YamlAlias("CheckOptions")]\r
+            public List<CheckOption> CheckOptions { get; set; }\r
+        }\r
+\r
+        public static List<KeyValuePair<string, ClangTidyProperties>> ParseConfigurationChain(string ClangTidyFile)\r
+        {\r
+            List<KeyValuePair<string, ClangTidyProperties>> Result = new List<KeyValuePair<string, ClangTidyProperties>>();\r
+            Result.Add(new KeyValuePair<string, ClangTidyProperties>(null, ClangTidyProperties.RootProperties));\r
+\r
+            foreach (string P in Utility.SplitPath(ClangTidyFile).Reverse())\r
+            {\r
+                if (!Utility.HasClangTidyFile(P))\r
+                    continue;\r
+\r
+                string ConfigFile = Path.Combine(P, ".clang-tidy");\r
+\r
+                using (StreamReader Reader = new StreamReader(ConfigFile))\r
+                {\r
+                    Deserializer D = new Deserializer(namingConvention: new PascalCaseNamingConvention());\r
+                    ClangTidyYaml Y = D.Deserialize<ClangTidyYaml>(Reader);\r
+                    ClangTidyProperties Parent = Result[Result.Count - 1].Value;\r
+                    ClangTidyProperties NewProps = new ClangTidyProperties(Parent);\r
+                    SetPropertiesFromYaml(Y, NewProps);\r
+                    Result.Add(new KeyValuePair<string, ClangTidyProperties>(P, NewProps));\r
+                }\r
+            }\r
+            return Result;\r
+        }\r
+\r
+        enum TreeLevelOp\r
+        {\r
+            Enable,\r
+            Disable,\r
+            Inherit\r
+        }\r
+\r
+        public static void SerializeClangTidyFile(ClangTidyProperties Props, string ClangTidyFilePath)\r
+        {\r
+            List<string> CommandList = new List<string>();\r
+            SerializeCheckTree(CommandList, Props.GetCheckTree(), TreeLevelOp.Inherit);\r
+\r
+            CommandList.Sort((x, y) =>\r
+            {\r
+                bool LeftSub = x.StartsWith("-");\r
+                bool RightSub = y.StartsWith("-");\r
+                if (LeftSub && !RightSub)\r
+                    return -1;\r
+                if (RightSub && !LeftSub)\r
+                    return 1;\r
+                return StringComparer.CurrentCulture.Compare(x, y);\r
+            });\r
+\r
+            string ConfigFile = Path.Combine(ClangTidyFilePath, ".clang-tidy");\r
+            using (StreamWriter Writer = new StreamWriter(ConfigFile))\r
+            {\r
+                Serializer S = new Serializer(namingConvention: new PascalCaseNamingConvention());\r
+                ClangTidyYaml Yaml = new ClangTidyYaml();\r
+                Yaml.Checks = String.Join(",", CommandList.ToArray());\r
+                S.Serialize(Writer, Yaml);\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Convert the given check tree into serialized list of commands that can be written to\r
+        /// the Yaml.  The goal here is to determine the minimal sequence of check commands that\r
+        /// will produce the exact configuration displayed in the UI.  This is complicated by the\r
+        /// fact that an inherited True is not the same as an explicitly specified True.  If the\r
+        /// user has chosen to inherit a setting in a .clang-tidy file, then changing it in the\r
+        /// parent should show the reflected changes in the current file as well.  So we cannot\r
+        /// simply -* everything and then add in the checks we need, because -* immediately marks\r
+        /// every single check as explicitly false, thus disabling inheritance.\r
+        /// </summary>\r
+        /// <param name="CommandList">State passed through this recursive algorithm representing\r
+        /// the sequence of commands we have determined so far.\r
+        /// </param>\r
+        /// <param name="Tree">The check tree to serialize.  This is the parameter that will be\r
+        /// recursed on as successive subtrees get serialized to `CommandList`.\r
+        /// </param>\r
+        /// <param name="CurrentOp">The current state of the subtree.  For example, if the\r
+        /// algorithm decides to -* an entire subtree and then add back one single check,\r
+        /// after adding a -subtree-* command to CommandList, it would pass in a value of\r
+        /// CurrentOp=TreeLevelOp.Disable when it recurses down.  This allows deeper iterations\r
+        /// of the algorithm to know what kind of command (if any) needs to be added to CommandList\r
+        /// in order to put a particular check into a particular state.\r
+        /// </param>\r
+        private static void SerializeCheckTree(List<string> CommandList, CheckTree Tree, TreeLevelOp CurrentOp)\r
+        {\r
+            int NumChecks = Tree.CountChecks;\r
+            int NumDisabled = Tree.CountExplicitlyDisabledChecks;\r
+            int NumEnabled = Tree.CountExplicitlyEnabledChecks;\r
+            int NumInherited = Tree.CountInheritedChecks;\r
+\r
+            if (NumChecks == 0)\r
+                return;\r
+\r
+            if (NumInherited > 0)\r
+                System.Diagnostics.Debug.Assert(CurrentOp == TreeLevelOp.Inherit);\r
+\r
+            // If this entire tree is inherited, just exit, nothing about this needs to\r
+            // go in the clang-tidy file.\r
+            if (NumInherited == NumChecks)\r
+                return;\r
+\r
+            TreeLevelOp NewOp = CurrentOp;\r
+            // If there are no inherited properties in this subtree, decide whether to\r
+            // explicitly enable or disable this subtree.  Decide by looking at whether\r
+            // there is a larger proportion of disabled or enabled descendants.  If\r
+            // there are more disabled items in this subtree for example, disabling the\r
+            // subtree will lead to a smaller configuration file.\r
+            if (NumInherited == 0)\r
+            {\r
+                if (NumDisabled >= NumEnabled)\r
+                    NewOp = TreeLevelOp.Disable;\r
+                else\r
+                    NewOp = TreeLevelOp.Enable;\r
+            }\r
+\r
+            if (NewOp == TreeLevelOp.Disable)\r
+            {\r
+                // Only add an explicit disable command if the tree was not already disabled\r
+                // to begin with.\r
+                if (CurrentOp != TreeLevelOp.Disable)\r
+                {\r
+                    string WildcardPath = "*";\r
+                    if (Tree.Path != null)\r
+                        WildcardPath = Tree.Path + "-" + WildcardPath;\r
+                    CommandList.Add("-" + WildcardPath);\r
+                }\r
+                // If the entire subtree was disabled, there's no point descending.\r
+                if (NumDisabled == NumChecks)\r
+                    return;\r
+            }\r
+            else if (NewOp == TreeLevelOp.Enable)\r
+            {\r
+                // Only add an explicit enable command if the tree was not already enabled\r
+                // to begin with.  Note that if we're at the root, all checks are already\r
+                // enabled by default, so there's no need to explicitly include *\r
+                if (CurrentOp != TreeLevelOp.Enable && Tree.Path != null)\r
+                {\r
+                    string WildcardPath = Tree.Path + "-*";\r
+                    CommandList.Add(WildcardPath);\r
+                }\r
+                // If the entire subtree was enabled, there's no point descending.\r
+                if (NumEnabled == NumChecks)\r
+                    return;\r
+            }\r
+\r
+            foreach (var Child in Tree.Children)\r
+            {\r
+                if (Child.Value is CheckLeaf)\r
+                {\r
+                    CheckLeaf Leaf = (CheckLeaf)Child.Value;\r
+                    if (Leaf.CountExplicitlyEnabledChecks == 1 && NewOp != TreeLevelOp.Enable)\r
+                        CommandList.Add(Leaf.Path);\r
+                    else if (Leaf.CountExplicitlyDisabledChecks == 1 && NewOp != TreeLevelOp.Disable)\r
+                        CommandList.Add("-" + Leaf.Path);\r
+                    continue;\r
+                }\r
+\r
+                System.Diagnostics.Debug.Assert(Child.Value is CheckTree);\r
+                CheckTree ChildTree = (CheckTree)Child.Value;\r
+                SerializeCheckTree(CommandList, ChildTree, NewOp);\r
+            }\r
+        }\r
+\r
+        private static void SetPropertiesFromYaml(ClangTidyYaml Yaml, ClangTidyProperties Props)\r
+        {\r
+            string[] CheckCommands = Yaml.Checks.Split(',');\r
+            foreach (string Command in CheckCommands)\r
+            {\r
+                if (Command == null || Command.Length == 0)\r
+                    continue;\r
+                bool Add = true;\r
+                string Pattern = Command;\r
+                if (Pattern[0] == '-')\r
+                {\r
+                    Pattern = Pattern.Substring(1);\r
+                    Add = false;\r
+                }\r
+\r
+                foreach (var Match in CheckDatabase.Checks.Where(x => Utility.MatchWildcardString(x.Name, Pattern)))\r
+                {\r
+                    Props.SetDynamicValue(Match.Name, Add);\r
+                }\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyConfigurationPage.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyConfigurationPage.cs
new file mode 100644 (file)
index 0000000..0f7a8e9
--- /dev/null
@@ -0,0 +1,61 @@
+using Microsoft.VisualStudio;\r
+using Microsoft.VisualStudio.Shell;\r
+using Microsoft.VisualStudio.Shell.Interop;\r
+using System;\r
+using System.Collections;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Linq;\r
+using System.Runtime.InteropServices;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+using System.Windows.Forms;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    [ClassInterface(ClassInterfaceType.AutoDual)]\r
+    [CLSCompliant(false), ComVisible(true)]\r
+    public class ClangTidyConfigurationPage : DialogPage\r
+    {\r
+        ClangTidyPropertyGrid Grid = null;\r
+        protected override IWin32Window Window\r
+        {\r
+            get\r
+            {\r
+                if (Grid == null)\r
+                    Grid = new ClangTidyPropertyGrid();\r
+                return Grid;\r
+            }\r
+        }\r
+\r
+        protected override void SaveSetting(PropertyDescriptor property)\r
+        {\r
+            base.SaveSetting(property);\r
+        }\r
+\r
+        public override void SaveSettingsToStorage()\r
+        {\r
+            if (Grid != null)\r
+                Grid.SaveSettingsToStorage();\r
+\r
+            base.SaveSettingsToStorage();\r
+        }\r
+\r
+        public override void ResetSettings()\r
+        {\r
+            base.ResetSettings();\r
+        }\r
+\r
+        protected override void LoadSettingFromStorage(PropertyDescriptor prop)\r
+        {\r
+            base.LoadSettingFromStorage(prop);\r
+        }\r
+\r
+        public override void LoadSettingsFromStorage()\r
+        {\r
+            if (Grid != null)\r
+                Grid.InitializeSettings();\r
+            base.LoadSettingsFromStorage();\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPackage.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPackage.cs
new file mode 100644 (file)
index 0000000..9a0c9b6
--- /dev/null
@@ -0,0 +1,56 @@
+//===-- ClangTidyPackages.cs - VSPackage for clang-tidy ----------*- C# -*-===//\r
+//\r
+//                     The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+//\r
+// This class contains a VS extension package that runs clang-tidy over a\r
+// file in a VS text editor.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+\r
+using Microsoft.VisualStudio.Editor;\r
+using Microsoft.VisualStudio.Shell;\r
+using Microsoft.VisualStudio.Shell.Interop;\r
+using Microsoft.VisualStudio.TextManager.Interop;\r
+using System;\r
+using System.Collections;\r
+using System.ComponentModel;\r
+using System.ComponentModel.Design;\r
+using System.IO;\r
+using System.Runtime.InteropServices;\r
+using System.Windows.Forms;\r
+using System.Xml.Linq;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    [PackageRegistration(UseManagedResourcesOnly = true)]\r
+    [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]\r
+    [ProvideMenuResource("Menus.ctmenu", 1)]\r
+    [Guid(GuidList.guidClangTidyPkgString)]\r
+    [ProvideOptionPage(typeof(ClangTidyConfigurationPage), "LLVM/Clang", "ClangTidy", 0, 0, true)]\r
+    public sealed class ClangTidyPackage : Package\r
+    {\r
+        #region Package Members\r
+        protected override void Initialize()\r
+        {\r
+            base.Initialize();\r
+\r
+            var commandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;\r
+            if (commandService != null)\r
+            {\r
+                var menuCommandID = new CommandID(GuidList.guidClangTidyCmdSet, (int)PkgCmdIDList.cmdidClangTidy);\r
+                var menuItem = new MenuCommand(MenuItemCallback, menuCommandID);\r
+                commandService.AddCommand(menuItem);\r
+            }\r
+        }\r
+        #endregion\r
+\r
+        private void MenuItemCallback(object sender, EventArgs args)\r
+        {\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyProperties.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyProperties.cs
new file mode 100644 (file)
index 0000000..ac83121
--- /dev/null
@@ -0,0 +1,84 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Globalization;\r
+using System.Linq;\r
+using System.Reflection;\r
+using System.Runtime.InteropServices;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+\r
+    public class ClangTidyProperties : DynamicPropertyComponent\r
+    {\r
+        private static ClangTidyProperties RootProperties_ = null;\r
+        private CheckTree CheckTree_;\r
+        private bool HasUnsavedChanges_ = false;\r
+\r
+        public struct CheckMapping\r
+        {\r
+            public string CheckName;\r
+            public string Property;\r
+        }\r
+\r
+        public ClangTidyProperties()\r
+            : base(null)\r
+        {\r
+            AddClangCheckProperties();\r
+            CheckTree_ = CheckTree.Build(this);\r
+        }\r
+\r
+        public ClangTidyProperties(DynamicPropertyComponent Parent)\r
+            : base(Parent)\r
+        {\r
+            AddClangCheckProperties();\r
+            CheckTree_ = CheckTree.Build(this);\r
+        }\r
+\r
+        static ClangTidyProperties()\r
+        {\r
+            RootProperties_ = new ClangTidyProperties(null);\r
+            PropertyDescriptor D;\r
+        }\r
+\r
+        public static ClangTidyProperties RootProperties\r
+        {\r
+            get { return RootProperties_; }\r
+        }\r
+\r
+        private void AddClangCheckProperties()\r
+        {\r
+            // Add each check in the check database\r
+            HashSet<string> Categories = new HashSet<string>();\r
+            foreach (var Check in CheckDatabase.Checks)\r
+            {\r
+                string Name = Check.Name.Replace('-', '_');\r
+                List<Attribute> Attrs = new List<Attribute>();\r
+                Attrs.Add(new CategoryAttribute(Check.Category));\r
+                Attrs.Add(new DisplayNameAttribute(Check.Label));\r
+                Attrs.Add(new DefaultValueAttribute(true));\r
+                Attrs.Add(new DescriptionAttribute(Check.Desc));\r
+                Attrs.Add(new ClangTidyCheckAttribute(Check.Name));\r
+                Categories.Add(Check.Category);\r
+                AddDynamicProperty<bool>(Check.Name, Attrs.ToArray());\r
+            }\r
+\r
+            // Add a category verb for each unique category.\r
+            foreach (string Cat in Categories)\r
+            {\r
+                List<Attribute> Attrs = new List<Attribute>();\r
+                Attrs.Add(new CategoryAttribute(Cat));\r
+                Attrs.Add(new DisplayNameAttribute("(Category Verbs)"));\r
+                Attrs.Add(new TypeConverterAttribute(typeof(CategoryVerbConverter)));\r
+                Attrs.Add(new DefaultValueAttribute(CategoryVerb.None));\r
+                AddDynamicProperty<CategoryVerb>(Cat + "Verb", Attrs.ToArray());\r
+            }\r
+        }\r
+\r
+        public CheckTree GetCheckTree() { return CheckTree_; }\r
+        public bool GetHasUnsavedChanges() { return HasUnsavedChanges_; }\r
+        public void SetHasUnsavedChanges(bool Value) { HasUnsavedChanges_ = Value; }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.Designer.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.Designer.cs
new file mode 100644 (file)
index 0000000..ce9324a
--- /dev/null
@@ -0,0 +1,119 @@
+namespace LLVM.ClangTidy\r
+{\r
+    partial class ClangTidyPropertyGrid\r
+    {\r
+        /// <summary> \r
+        /// Required designer variable.\r
+        /// </summary>\r
+        private System.ComponentModel.IContainer components = null;\r
+\r
+        /// <summary> \r
+        /// Clean up any resources being used.\r
+        /// </summary>\r
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>\r
+        protected override void Dispose(bool disposing)\r
+        {\r
+            if (disposing && (components != null))\r
+            {\r
+                components.Dispose();\r
+            }\r
+            base.Dispose(disposing);\r
+        }\r
+\r
+        #region Component Designer generated code\r
+\r
+        /// <summary> \r
+        /// Required method for Designer support - do not modify \r
+        /// the contents of this method with the code editor.\r
+        /// </summary>\r
+        private void InitializeComponent()\r
+        {\r
+            this.label1 = new System.Windows.Forms.Label();\r
+            this.textBox1 = new System.Windows.Forms.TextBox();\r
+            this.button1 = new System.Windows.Forms.Button();\r
+            this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();\r
+            this.clangTidyProperties1 = new LLVM.ClangTidy.ClangTidyProperties();\r
+            this.clangTidyConfigurationPage1 = new LLVM.ClangTidy.ClangTidyConfigurationPage();\r
+            this.linkLabelPath = new System.Windows.Forms.LinkLabel();\r
+            this.SuspendLayout();\r
+            // \r
+            // label1\r
+            // \r
+            this.label1.AutoSize = true;\r
+            this.label1.Location = new System.Drawing.Point(14, 17);\r
+            this.label1.Name = "label1";\r
+            this.label1.Size = new System.Drawing.Size(88, 13);\r
+            this.label1.TabIndex = 0;\r
+            this.label1.Text = "Configuration File";\r
+            // \r
+            // textBox1\r
+            // \r
+            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) \r
+            | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.textBox1.Location = new System.Drawing.Point(108, 14);\r
+            this.textBox1.Name = "textBox1";\r
+            this.textBox1.Size = new System.Drawing.Size(222, 20);\r
+            this.textBox1.TabIndex = 1;\r
+            // \r
+            // button1\r
+            // \r
+            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.button1.Location = new System.Drawing.Point(336, 14);\r
+            this.button1.Name = "button1";\r
+            this.button1.Size = new System.Drawing.Size(78, 20);\r
+            this.button1.TabIndex = 2;\r
+            this.button1.Text = "Browse";\r
+            this.button1.UseVisualStyleBackColor = true;\r
+            this.button1.Click += new System.EventHandler(this.button1_Click);\r
+            // \r
+            // propertyGrid1\r
+            // \r
+            this.propertyGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) \r
+            | System.Windows.Forms.AnchorStyles.Left) \r
+            | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.propertyGrid1.Location = new System.Drawing.Point(20, 73);\r
+            this.propertyGrid1.Name = "propertyGrid1";\r
+            this.propertyGrid1.SelectedObject = this.clangTidyProperties1;\r
+            this.propertyGrid1.Size = new System.Drawing.Size(391, 384);\r
+            this.propertyGrid1.TabIndex = 6;\r
+            this.propertyGrid1.ViewBorderColor = System.Drawing.SystemColors.ControlDarkDark;\r
+            this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged);\r
+            // \r
+            // linkLabelPath\r
+            // \r
+            this.linkLabelPath.AutoSize = true;\r
+            this.linkLabelPath.Location = new System.Drawing.Point(29, 50);\r
+            this.linkLabelPath.Name = "linkLabelPath";\r
+            this.linkLabelPath.Size = new System.Drawing.Size(55, 13);\r
+            this.linkLabelPath.TabIndex = 7;\r
+            this.linkLabelPath.TabStop = true;\r
+            this.linkLabelPath.Text = "linkLabel1";\r
+            this.linkLabelPath.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelPath_LinkClicked);\r
+            // \r
+            // ClangTidyPropertyGrid\r
+            // \r
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+            this.Controls.Add(this.linkLabelPath);\r
+            this.Controls.Add(this.propertyGrid1);\r
+            this.Controls.Add(this.button1);\r
+            this.Controls.Add(this.textBox1);\r
+            this.Controls.Add(this.label1);\r
+            this.Name = "ClangTidyPropertyGrid";\r
+            this.Size = new System.Drawing.Size(444, 469);\r
+            this.ResumeLayout(false);\r
+            this.PerformLayout();\r
+\r
+        }\r
+\r
+        #endregion\r
+\r
+        private System.Windows.Forms.Label label1;\r
+        private System.Windows.Forms.TextBox textBox1;\r
+        private System.Windows.Forms.Button button1;\r
+        private System.Windows.Forms.PropertyGrid propertyGrid1;\r
+        private ClangTidyProperties clangTidyProperties1;\r
+        private ClangTidyConfigurationPage clangTidyConfigurationPage1;\r
+        private System.Windows.Forms.LinkLabel linkLabelPath;\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.cs
new file mode 100644 (file)
index 0000000..c6d9370
--- /dev/null
@@ -0,0 +1,215 @@
+//===-- ClangTidyPropertyGrid.cs - UI for configuring clang-tidy -*- C# -*-===//\r
+//\r
+//                     The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+//\r
+// This class contains a UserControl consisting of a .NET PropertyGrid control\r
+// allowing configuration of checks and check options for ClangTidy.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Drawing;\r
+using System.Data;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+using System.Windows.Forms;\r
+using System.IO;\r
+using Microsoft.VisualStudio.Shell;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    /// <summary>\r
+    ///  A UserControl displaying a PropertyGrid allowing configuration of clang-tidy\r
+    ///  checks and check options, as well as serialization and deserialization of\r
+    ///  clang-tidy configuration files.  When a configuration file is loaded, the\r
+    ///  entire chain of configuration files is analyzed based on the file path,\r
+    ///  and quick access is provided to edit or view any of the files in the\r
+    ///  configuration chain, allowing easy visualization of where values come from\r
+    ///  (similar in spirit to the -explain-config option of clang-tidy).\r
+    /// </summary>\r
+    public partial class ClangTidyPropertyGrid : UserControl\r
+    {\r
+        /// <summary>\r
+        /// The sequence of .clang-tidy configuration files, starting from the root\r
+        /// of the filesystem, down to the selected file.\r
+        /// </summary>\r
+        List<KeyValuePair<string, ClangTidyProperties>> PropertyChain_ = null;\r
+\r
+        /// <summary>\r
+        /// A tree representing all the checks that the extension knows about, used\r
+        /// when serializing a file to intelligently determine when to use wildcard\r
+        /// include / exclude rules.\r
+        /// </summary>\r
+        CheckTree Checks_;\r
+\r
+        public ClangTidyPropertyGrid()\r
+        {\r
+            InitializeComponent();\r
+            InitializeSettings();\r
+        }\r
+\r
+        private enum ShouldCancel\r
+        {\r
+            Yes,\r
+            No,\r
+        }\r
+\r
+        public void SaveSettingsToStorage()\r
+        {\r
+            PersistUnsavedChanges(false);\r
+        }\r
+\r
+        private ShouldCancel PersistUnsavedChanges(bool PromptFirst)\r
+        {\r
+            var UnsavedResults = PropertyChain_.Where(x => x.Key != null && x.Value.GetHasUnsavedChanges());\r
+            if (UnsavedResults.Count() == 0)\r
+                return ShouldCancel.No;\r
+\r
+            bool ShouldSave = false;\r
+            if (PromptFirst)\r
+            {\r
+                var Response = MessageBox.Show(\r
+                    "You have unsaved changes!  Do you want to save before loading a new file?",\r
+                    "clang-tidy",\r
+                    MessageBoxButtons.YesNoCancel);\r
+\r
+                ShouldSave = (Response == DialogResult.Yes);\r
+                if (Response == DialogResult.Cancel)\r
+                    return ShouldCancel.Yes;\r
+            }\r
+            else\r
+                ShouldSave = true;\r
+\r
+            if (ShouldSave)\r
+            {\r
+                foreach (var Result in UnsavedResults)\r
+                {\r
+                    ClangTidyConfigParser.SerializeClangTidyFile(Result.Value, Result.Key);\r
+                    Result.Value.SetHasUnsavedChanges(false);\r
+                }\r
+            }\r
+            return ShouldCancel.No;\r
+        }\r
+\r
+        public void InitializeSettings()\r
+        {\r
+            PropertyChain_ = new List<KeyValuePair<string, ClangTidyProperties>>();\r
+            PropertyChain_.Add(new KeyValuePair<string, ClangTidyProperties>(null, ClangTidyProperties.RootProperties));\r
+            reloadPropertyChain();\r
+        }\r
+\r
+        private void button1_Click(object sender, EventArgs e)\r
+        {\r
+            ShouldCancel Cancel = PersistUnsavedChanges(true);\r
+            if (Cancel == ShouldCancel.Yes)\r
+                return;\r
+\r
+            using (OpenFileDialog D = new OpenFileDialog())\r
+            {\r
+                D.Filter = "Clang Tidy files|.clang-tidy";\r
+                D.CheckPathExists = true;\r
+                D.CheckFileExists = true;\r
+\r
+                if (D.ShowDialog() == DialogResult.OK)\r
+                {\r
+                    PropertyChain_.Clear();\r
+                    PropertyChain_ = ClangTidyConfigParser.ParseConfigurationChain(D.FileName);\r
+                    textBox1.Text = D.FileName;\r
+                    reloadPropertyChain();\r
+                }\r
+            }\r
+        }\r
+\r
+        private static readonly string DefaultText = "(Default)";\r
+        private static readonly string BrowseText = "Browse for a file to edit its properties";\r
+\r
+        /// <summary>\r
+        /// After a new configuration file is chosen, analyzes the directory hierarchy\r
+        /// and finds all .clang-tidy files in the path, parses them and updates the\r
+        /// PropertyGrid and quick-access LinkLabel control to reflect the new property\r
+        /// chain.\r
+        /// </summary>\r
+        private void reloadPropertyChain()\r
+        {\r
+            StringBuilder LinkBuilder = new StringBuilder();\r
+            LinkBuilder.Append(DefaultText);\r
+            LinkBuilder.Append(" > ");\r
+            int PrefixLength = LinkBuilder.Length;\r
+\r
+            if (PropertyChain_.Count == 1)\r
+                LinkBuilder.Append(BrowseText);\r
+            else\r
+                LinkBuilder.Append(PropertyChain_[PropertyChain_.Count - 1].Key);\r
+\r
+            linkLabelPath.Text = LinkBuilder.ToString();\r
+\r
+            // Given a path like D:\Foo\Bar\Baz, construct a LinkLabel where individual\r
+            // components of the path are clickable iff they contain a .clang-tidy file.\r
+            // Clicking one of the links then updates the PropertyGrid to display the\r
+            // selected .clang-tidy file.\r
+            ClangTidyProperties LastProps = ClangTidyProperties.RootProperties;\r
+            linkLabelPath.Links.Clear();\r
+            linkLabelPath.Links.Add(0, DefaultText.Length, LastProps);\r
+            foreach (var Prop in PropertyChain_.Skip(1))\r
+            {\r
+                LastProps = Prop.Value;\r
+                string ClangTidyFolder = Path.GetFileName(Prop.Key);\r
+                int ClangTidyFolderOffset = Prop.Key.Length - ClangTidyFolder.Length;\r
+                linkLabelPath.Links.Add(PrefixLength + ClangTidyFolderOffset, ClangTidyFolder.Length, LastProps);\r
+            }\r
+            propertyGrid1.SelectedObject = LastProps;\r
+        }\r
+\r
+        private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)\r
+        {\r
+            ClangTidyProperties Props = (ClangTidyProperties)propertyGrid1.SelectedObject;\r
+            Props.SetHasUnsavedChanges(true);\r
+\r
+            // When a CategoryVerb is selected, perform the corresponding action.\r
+            PropertyDescriptor Property = e.ChangedItem.PropertyDescriptor;\r
+            if (!(e.ChangedItem.Value is CategoryVerb))\r
+                return;\r
+\r
+            CategoryVerb Action = (CategoryVerb)e.ChangedItem.Value;\r
+            if (Action == CategoryVerb.None)\r
+                return;\r
+\r
+            var Category = Property.Attributes.OfType<CategoryAttribute>().FirstOrDefault();\r
+            if (Category == null)\r
+                return;\r
+            var SameCategoryProps = Props.GetProperties(new Attribute[] { Category });\r
+            foreach (PropertyDescriptor P in SameCategoryProps)\r
+            {\r
+                if (P == Property)\r
+                    continue;\r
+                switch (Action)\r
+                {\r
+                    case CategoryVerb.Disable:\r
+                        P.SetValue(propertyGrid1.SelectedObject, false);\r
+                        break;\r
+                    case CategoryVerb.Enable:\r
+                        P.SetValue(propertyGrid1.SelectedObject, true);\r
+                        break;\r
+                    case CategoryVerb.Inherit:\r
+                        P.ResetValue(propertyGrid1.SelectedObject);\r
+                        break;\r
+                }\r
+            }\r
+            Property.ResetValue(propertyGrid1.SelectedObject);\r
+            propertyGrid1.Invalidate();\r
+        }\r
+\r
+        private void linkLabelPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)\r
+        {\r
+            ClangTidyProperties Props = (ClangTidyProperties)e.Link.LinkData;\r
+            propertyGrid1.SelectedObject = Props;\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.resx b/clang-tools-extra/clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.resx
new file mode 100644 (file)
index 0000000..22dfde0
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+  <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 2.0\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">2.0</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        <value>[base64 mime encoded serialized .NET Framework object]</value>\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r
+        <comment>This is a comment</comment>\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used for serialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />\r
+    <xsd:element name="root" msdata:IsDataSet="true">\r
+      <xsd:complexType>\r
+        <xsd:choice maxOccurs="unbounded">\r
+          <xsd:element name="metadata">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" use="required" type="xsd:string" />\r
+              <xsd:attribute name="type" type="xsd:string" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="assembly">\r
+            <xsd:complexType>\r
+              <xsd:attribute name="alias" type="xsd:string" />\r
+              <xsd:attribute name="name" type="xsd:string" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="data">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />\r
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="resheader">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+        </xsd:choice>\r
+      </xsd:complexType>\r
+    </xsd:element>\r
+  </xsd:schema>\r
+  <resheader name="resmimetype">\r
+    <value>text/microsoft-resx</value>\r
+  </resheader>\r
+  <resheader name="version">\r
+    <value>2.0</value>\r
+  </resheader>\r
+  <resheader name="reader">\r
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <resheader name="writer">\r
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <metadata name="clangTidyConfigurationPage1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>183, 17</value>\r
+  </metadata>\r
+</root>
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyComponent.Designer.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyComponent.Designer.cs
new file mode 100644 (file)
index 0000000..099f1c0
--- /dev/null
@@ -0,0 +1,42 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    partial class DynamicPropertyComponent\r
+    {\r
+        /// <summary>\r
+        /// Required designer variable.\r
+        /// </summary>\r
+        private System.ComponentModel.IContainer components = null;\r
+\r
+        /// <summary> \r
+        /// Clean up any resources being used.\r
+        /// </summary>\r
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>\r
+        protected override void Dispose(bool disposing)\r
+        {\r
+            if (disposing && (components != null))\r
+            {\r
+                components.Dispose();\r
+            }\r
+            base.Dispose(disposing);\r
+        }\r
+\r
+        #region Component Designer generated code\r
+\r
+        /// <summary>\r
+        /// Required method for Designer support - do not modify\r
+        /// the contents of this method with the code editor.\r
+        /// </summary>\r
+        private void InitializeComponent()\r
+        {\r
+            components = new System.ComponentModel.Container();\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyComponent.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyComponent.cs
new file mode 100644 (file)
index 0000000..e8843db
--- /dev/null
@@ -0,0 +1,138 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    /// <summary>\r
+    /// The goal of this class is to enable displaying of a PropertyGrid in much the\r
+    /// same way that Visual Studio's C++ project system does.  A project or file can\r
+    /// have properties which might inherit from their parent, or be overridden.\r
+    /// It turns out this is somewhat non-trivial.  The .NET PropertyGrid is good makes\r
+    /// displaying simple properties with a static notion of what constitutes a\r
+    /// "default" value very easy.  You simply apply an Attribute to the class that says\r
+    /// what the default value is and you're done.  But when you try to introduce the idea\r
+    /// that a property's default value depends on some other factor, things get much more\r
+    /// complicated due to the static nature of Attributes.\r
+    /// \r
+    /// The solution to this is to inherit from ICustomTypeDescriptor.  This is the mechanism\r
+    /// by which you can inject or modify attributes or properties at runtime.  The .NET\r
+    /// PropertyGrid is designed in such a way that instead of using simple .NET Reflection to\r
+    /// look for the properties and attributes on a class, it will invoke the methods of\r
+    /// ICustomTypeDescriptor (if your type inherits from it), and ask those methods.  Our\r
+    /// implementation of ICustomTypeDescriptor works by waiting until the PropertyGrid requests\r
+    /// PropertyDescriptors for each of the properties, and then "decorating" them with our\r
+    /// own custom PropertyDescriptor implementation which understands the proeprty inheritance\r
+    /// model we wish to implement.\r
+    /// </summary>\r
+    public partial class DynamicPropertyComponent : Component, ICustomTypeDescriptor\r
+    {\r
+        PropertyDescriptorCollection DynamicProperties_ = new PropertyDescriptorCollection(null);\r
+        private DynamicPropertyComponent Parent_;\r
+\r
+        public DynamicPropertyComponent(DynamicPropertyComponent Parent)\r
+        {\r
+            Parent_ = Parent;\r
+        }\r
+\r
+        public DynamicPropertyComponent(DynamicPropertyComponent Parent, IContainer container)\r
+        {\r
+            Parent_ = Parent;\r
+\r
+            container.Add(this);\r
+            InitializeComponent();\r
+        }\r
+\r
+        public AttributeCollection GetAttributes()\r
+        {\r
+            return TypeDescriptor.GetAttributes(GetType());\r
+        }\r
+\r
+        public string GetClassName()\r
+        {\r
+            return TypeDescriptor.GetClassName(GetType());\r
+        }\r
+\r
+        public string GetComponentName()\r
+        {\r
+            return TypeDescriptor.GetComponentName(GetType());\r
+        }\r
+\r
+        public TypeConverter GetConverter()\r
+        {\r
+            return TypeDescriptor.GetConverter(GetType());\r
+        }\r
+\r
+        public EventDescriptor GetDefaultEvent()\r
+        {\r
+            return TypeDescriptor.GetDefaultEvent(GetType());\r
+        }\r
+\r
+        public PropertyDescriptor GetDefaultProperty()\r
+        {\r
+            return TypeDescriptor.GetDefaultProperty(GetType());\r
+        }\r
+\r
+        public object GetEditor(Type editorBaseType)\r
+        {\r
+            return TypeDescriptor.GetEditor(GetType(), editorBaseType);\r
+        }\r
+\r
+        public EventDescriptorCollection GetEvents()\r
+        {\r
+            return TypeDescriptor.GetEvents(GetType());\r
+        }\r
+\r
+        public EventDescriptorCollection GetEvents(Attribute[] attributes)\r
+        {\r
+            return TypeDescriptor.GetEvents(GetType(), attributes);\r
+        }\r
+\r
+        public PropertyDescriptorCollection GetProperties()\r
+        {\r
+            return DynamicProperties_;\r
+        }\r
+\r
+        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)\r
+        {\r
+            var Props = DynamicProperties_.OfType<PropertyDescriptor>();\r
+            var Filtered = Props.Where(x => x.Attributes.Contains(attributes)).ToArray();\r
+            return new PropertyDescriptorCollection(Filtered);\r
+        }\r
+\r
+        public object GetPropertyOwner(PropertyDescriptor pd)\r
+        {\r
+            return this;\r
+        }\r
+\r
+        public void SetDynamicValue<T>(string Name, T Value)\r
+        {\r
+            Name = Name.Replace('-', '_');\r
+            DynamicPropertyDescriptor<T> Descriptor = (DynamicPropertyDescriptor<T>)DynamicProperties_.Find(Name, false);\r
+            Descriptor.SetValue(this, Value);\r
+        }\r
+\r
+        public T GetDynamicValue<T>(string Name)\r
+        {\r
+            Name = Name.Replace('-', '_');\r
+            DynamicPropertyDescriptor<T> Descriptor = (DynamicPropertyDescriptor<T>)DynamicProperties_.Find(Name, false);\r
+            return (T)Descriptor.GetValue(this);\r
+        }\r
+\r
+        protected void AddDynamicProperty<T>(string Name, Attribute[] Attributes)\r
+        {\r
+            Name = Name.Replace('-', '_');\r
+\r
+            // If we have a parent, find the corresponding PropertyDescriptor with the same\r
+            // name from the parent.\r
+            DynamicPropertyDescriptor<T> ParentDescriptor = null;\r
+            if (Parent_ != null)\r
+                ParentDescriptor = (DynamicPropertyDescriptor<T>)Parent_.GetProperties().Find(Name, false);\r
+\r
+            DynamicProperties_.Add(new DynamicPropertyDescriptor<T>(Name, ParentDescriptor, Name, Attributes));\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyConverter.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyConverter.cs
new file mode 100644 (file)
index 0000000..9442667
--- /dev/null
@@ -0,0 +1,139 @@
+using System;\r
+using System.Collections;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Globalization;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    class MagicInheritance\r
+    {\r
+        public static readonly string Value = "{3A27184D-1774-489B-9BB7-7191B8E8E622}";\r
+        public static readonly string Text = "<Inherit from project or parent>";\r
+    }\r
+\r
+\r
+    class DynamicPropertyConverter<T> : TypeConverter\r
+    {\r
+        private DynamicPropertyDescriptor<T> Descriptor_;\r
+        private TypeConverter Root_;\r
+\r
+        public DynamicPropertyConverter(DynamicPropertyDescriptor<T> Descriptor, TypeConverter Root)\r
+        {\r
+            Descriptor_ = Descriptor;\r
+            Root_ = Root;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Returns true if there are specific values that can be chosen from a dropdown\r
+        /// for this property.  Regardless of whether standard values are supported for\r
+        /// the underlying type, we always support standard values because we need to\r
+        /// display the inheritance option.\r
+        /// </summary>\r
+        /// <returns>true</returns>\r
+        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)\r
+        {\r
+            return true;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Get the set of all standard values that can be chosen from a dropdown for this\r
+        /// property.  If the underlying type supports standard values, we want to include\r
+        /// all those.  Additionally, we want to display the option to inherit the value,\r
+        /// but only if the value is not already inheriting.\r
+        /// </summary>\r
+        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)\r
+        {\r
+            List<object> Values = new List<object>();\r
+            if (Root_.GetStandardValuesSupported(context))\r
+            {\r
+                StandardValuesCollection RootValues = Root_.GetStandardValues(context);\r
+                Values.AddRange(RootValues.Cast<object>());\r
+            }\r
+            if (!Descriptor_.IsInheriting)\r
+                Values.Add(MagicInheritance.Value);\r
+            StandardValuesCollection Result = new StandardValuesCollection(Values);\r
+            return Result;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Determines whether this property can accept values other than those specified\r
+        /// in the dropdown (for example by manually typing into the field).\r
+        /// </summary>\r
+        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)\r
+        {\r
+            // Although we add items to the dropdown list, we do not change whether or not\r
+            // the set of values are exclusive.  If the user could type into the field before\r
+            // they still can.  And if they couldn't before, they still can't.\r
+            return Root_.GetStandardValuesExclusive(context);\r
+        }\r
+\r
+        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)\r
+        {\r
+            return Root_.CanConvertFrom(context, sourceType);\r
+        }\r
+\r
+        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)\r
+        {\r
+            return Root_.CanConvertTo(context, destinationType);\r
+        }\r
+\r
+        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\r
+        {\r
+            if (value.Equals(MagicInheritance.Value))\r
+                return MagicInheritance.Text;\r
+            return Root_.ConvertFrom(context, culture, value);\r
+        }\r
+\r
+        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)\r
+        {\r
+            if (value.GetType() == destinationType)\r
+                return value;\r
+\r
+            return Root_.ConvertTo(context, culture, value, destinationType);\r
+        }\r
+\r
+        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)\r
+        {\r
+            return Root_.CreateInstance(context, propertyValues);\r
+        }\r
+\r
+        public override bool Equals(object obj)\r
+        {\r
+            return Root_.Equals(obj);\r
+        }\r
+\r
+        public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)\r
+        {\r
+            return Root_.GetCreateInstanceSupported(context);\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            return Root_.GetHashCode();\r
+        }\r
+\r
+        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)\r
+        {\r
+            return Root_.GetProperties(context, value, attributes);\r
+        }\r
+\r
+        public override bool GetPropertiesSupported(ITypeDescriptorContext context)\r
+        {\r
+            return Root_.GetPropertiesSupported(context);\r
+        }\r
+\r
+        public override bool IsValid(ITypeDescriptorContext context, object value)\r
+        {\r
+            return Root_.IsValid(context, value);\r
+        }\r
+\r
+        public override string ToString()\r
+        {\r
+            return Root_.ToString();\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyDescriptor.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/DynamicPropertyDescriptor.cs
new file mode 100644 (file)
index 0000000..f0d7691
--- /dev/null
@@ -0,0 +1,137 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    public class DynamicPropertyDescriptor<T> : PropertyDescriptor\r
+    {\r
+        T Value_;\r
+        DynamicPropertyDescriptor<T> Parent_;\r
+        bool IsInheriting_;\r
+        object Component_;\r
+\r
+        public DynamicPropertyDescriptor(object Component, DynamicPropertyDescriptor<T> Parent, string Name, Attribute[] Attrs)\r
+            : base(Name, Attrs)\r
+        {\r
+            foreach (DefaultValueAttribute Attr in Attrs.OfType<DefaultValueAttribute>())\r
+            {\r
+                Value_ = (T)Attr.Value;\r
+            }\r
+            Parent_ = Parent;\r
+            IsInheriting_ = true;\r
+            Component_ = Component;\r
+        }\r
+\r
+        public bool IsInheriting { get { return IsInheriting_; } set { IsInheriting_ = value; } }\r
+        public DynamicPropertyDescriptor<T> Parent { get { return Parent_; } }\r
+\r
+        /// <summary>\r
+        /// Determines whether this property's value should be considered "default" (e.g.\r
+        /// displayed in bold in the property grid).  Root properties are unmodifiable and\r
+        /// always default.  Non-root properties are default iff they are inheriting.\r
+        /// That is to say, if a property is explicitly set to False, the property should\r
+        /// be serialized even if the parent is also False.  It would only not be serialized\r
+        /// if the user had explicitly chosen to inherit it.\r
+        /// </summary>\r
+        /// <param name="component"></param>\r
+        /// <returns></returns>\r
+        public override bool ShouldSerializeValue(object component)\r
+        {\r
+            return (Parent_ != null) && !IsInheriting;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Set the value back to the default.  For root properties, this essentially does\r
+        /// nothing as they are read-only anyway.  For non-root properties, this only means\r
+        /// that the property is now inheriting.\r
+        /// </summary>\r
+        /// <param name="component"></param>\r
+        public override void ResetValue(object component)\r
+        {\r
+            IsInheriting_ = true;\r
+        }\r
+\r
+        public override void SetValue(object component, object value)\r
+        {\r
+            // This is a bit of a trick.  If the user chose the inheritance option from the\r
+            // dropdown, we will try to set the value to that string.  So look for that and\r
+            // then just reset the value.\r
+            if (value.Equals(MagicInheritance.Text))\r
+                ResetValue(component);\r
+            else\r
+            {\r
+                // By explicitly setting the value, this property is no longer inheriting,\r
+                // even if the value the property is being set to is the same as that of\r
+                // the parent.\r
+                IsInheriting_ = false;\r
+                Value_ = (T)value;\r
+            }\r
+        }\r
+\r
+        public override TypeConverter Converter\r
+        {\r
+            get\r
+            {\r
+                // We need to return a DynamicPropertyConverter<> that can deal with our requirement\r
+                // to inject the inherit property option into the dropdown.  But we still need to use\r
+                // the "real" converter to do the actual work for the underlying type.  Therefore,\r
+                // we need to look for a TypeConverter<> attribute on the property, and if it is present\r
+                // forward an instance of that converter to the DynamicPropertyConverter<>.  Otherwise,\r
+                // forward an instance of the default converter for type T to the DynamicPropertyConverter<>.\r
+                TypeConverter UnderlyingConverter = null;\r
+                var ConverterAttr = this.Attributes.OfType<TypeConverterAttribute>().LastOrDefault();\r
+                if (ConverterAttr != null)\r
+                {\r
+                    Type ConverterType = Type.GetType(ConverterAttr.ConverterTypeName);\r
+                    UnderlyingConverter = (TypeConverter)Activator.CreateInstance(ConverterType);\r
+                }\r
+                else\r
+                    UnderlyingConverter = TypeDescriptor.GetConverter(typeof(T));\r
+\r
+                return new DynamicPropertyConverter<T>(this, UnderlyingConverter);\r
+            }\r
+        }\r
+\r
+        public override bool IsReadOnly\r
+        {\r
+            get\r
+            {\r
+                return (Parent_ == null);\r
+            }\r
+        }\r
+\r
+        public override Type ComponentType\r
+        {\r
+            get\r
+            {\r
+                return Component_.GetType();\r
+            }\r
+        }\r
+\r
+        public override object GetValue(object component)\r
+        {\r
+            // Return either this property's value or the parents value, depending on\r
+            // whether or not this property is inheriting.\r
+            if (IsInheriting_ && Parent != null)\r
+                return Parent.GetValue(component);\r
+            return Value_;\r
+        }\r
+\r
+        public override bool CanResetValue(object component)\r
+        {\r
+            return !IsReadOnly;\r
+        }\r
+\r
+        public override Type PropertyType\r
+        {\r
+            get\r
+            {\r
+                return typeof(T);\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/ForwardingPropertyDescriptor.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/ForwardingPropertyDescriptor.cs
new file mode 100644 (file)
index 0000000..22b08fb
--- /dev/null
@@ -0,0 +1,191 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    /// <summary>\r
+    /// A decorator of sorts.  Accepts a PropertyDescriptor to its constructor\r
+    /// and forwards all calls to the underlying PropertyDescriptor.  In this way\r
+    /// we can inherit from ForwardingPropertyDescriptor and override only the\r
+    /// few methods we need to customize the behavior of, while allowing the\r
+    /// underlying PropertyDescriptor to do the real work.\r
+    /// </summary>\r
+    public abstract class ForwardingPropertyDescriptor : PropertyDescriptor\r
+    {\r
+        private readonly PropertyDescriptor root;\r
+        protected PropertyDescriptor Root { get { return root; } }\r
+        protected ForwardingPropertyDescriptor(PropertyDescriptor root)\r
+            : base(root)\r
+        {\r
+            this.root = root;\r
+        }\r
+\r
+        public override void AddValueChanged(object component, EventHandler handler)\r
+        {\r
+            root.AddValueChanged(component, handler);\r
+        }\r
+\r
+        public override AttributeCollection Attributes\r
+        {\r
+            get\r
+            {\r
+                return root.Attributes;\r
+            }\r
+        }\r
+\r
+        public override bool CanResetValue(object component)\r
+        {\r
+            return root.CanResetValue(component);\r
+        }\r
+\r
+        public override string Category\r
+        {\r
+            get\r
+            {\r
+                return root.Category;\r
+            }\r
+        }\r
+\r
+        public override Type ComponentType\r
+        {\r
+            get\r
+            {\r
+                return root.ComponentType;\r
+            }\r
+        }\r
+\r
+        public override TypeConverter Converter\r
+        {\r
+            get\r
+            {\r
+                return root.Converter;\r
+            }\r
+        }\r
+\r
+        public override string Description\r
+        {\r
+            get\r
+            {\r
+                return root.Description;\r
+            }\r
+        }\r
+\r
+        public override bool DesignTimeOnly\r
+        {\r
+            get\r
+            {\r
+                return root.DesignTimeOnly;\r
+            }\r
+        }\r
+\r
+        public override string DisplayName\r
+        {\r
+            get\r
+            {\r
+                return root.DisplayName;\r
+            }\r
+        }\r
+\r
+        public override bool Equals(object obj)\r
+        {\r
+            return root.Equals(obj);\r
+        }\r
+\r
+        public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter)\r
+        {\r
+            return root.GetChildProperties(instance, filter);\r
+        }\r
+\r
+        public override object GetEditor(Type editorBaseType)\r
+        {\r
+            return root.GetEditor(editorBaseType);\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            return root.GetHashCode();\r
+        }\r
+\r
+        public override object GetValue(object component)\r
+        {\r
+            return root.GetValue(component);\r
+        }\r
+\r
+        public override bool IsBrowsable\r
+        {\r
+            get\r
+            {\r
+                return root.IsBrowsable;\r
+            }\r
+        }\r
+\r
+        public override bool IsLocalizable\r
+        {\r
+            get\r
+            {\r
+                return root.IsLocalizable;\r
+            }\r
+        }\r
+\r
+        public override bool IsReadOnly\r
+        {\r
+            get\r
+            {\r
+                return root.IsReadOnly;\r
+            }\r
+        }\r
+\r
+        public override string Name\r
+        {\r
+            get\r
+            {\r
+                return root.Name;\r
+            }\r
+        }\r
+\r
+        public override Type PropertyType\r
+        {\r
+            get\r
+            {\r
+                return root.PropertyType;\r
+            }\r
+        }\r
+\r
+        public override void RemoveValueChanged(object component, EventHandler handler)\r
+        {\r
+            root.RemoveValueChanged(component, handler);\r
+        }\r
+\r
+        public override void ResetValue(object component)\r
+        {\r
+            root.ResetValue(component);\r
+        }\r
+\r
+        public override void SetValue(object component, object value)\r
+        {\r
+            root.SetValue(component, value);\r
+        }\r
+\r
+        public override bool ShouldSerializeValue(object component)\r
+        {\r
+            return root.ShouldSerializeValue(component);\r
+        }\r
+\r
+        public override bool SupportsChangeEvents\r
+        {\r
+            get\r
+            {\r
+                return root.SupportsChangeEvents;\r
+            }\r
+        }\r
+\r
+        public override string ToString()\r
+        {\r
+            return root.ToString();\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/GlobalSuppressions.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/GlobalSuppressions.cs
new file mode 100644 (file)
index 0000000..175a74e
--- /dev/null
@@ -0,0 +1,11 @@
+// This file is used by Code Analysis to maintain SuppressMessage\r
+// attributes that are applied to this project. Project-level\r
+// suppressions either have no target or are given a specific target\r
+// and scoped to a namespace, type, member, etc.\r
+//\r
+// To add a suppression to this file, right-click the message in the\r
+// Error List, point to "Suppress Message(s)", and click "In Project\r
+// Suppression File". You do not need to add suppressions to this\r
+// file manually.\r
+\r
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")]\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Guids.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/Guids.cs
new file mode 100644 (file)
index 0000000..0c99a6f
--- /dev/null
@@ -0,0 +1,12 @@
+using System;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    static class GuidList\r
+    {\r
+        public const string guidClangTidyPkgString = "AE4956BE-3DB8-430E-BBAB-7E2E9A014E9C";\r
+        public const string guidClangTidyCmdSetString = "9E0F0493-6493-46DE-AEE1-ACD8F60F265E";\r
+\r
+        public static readonly Guid guidClangTidyCmdSet = new Guid(guidClangTidyCmdSetString);\r
+    };\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/PkgCmdID.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/PkgCmdID.cs
new file mode 100644 (file)
index 0000000..3faf403
--- /dev/null
@@ -0,0 +1,7 @@
+namespace LLVM.ClangTidy\r
+{\r
+    static class PkgCmdIDList\r
+    {\r
+        public const uint cmdidClangTidy = 0x100;\r
+    };\r
+}
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Properties/AssemblyInfo.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..7105305
--- /dev/null
@@ -0,0 +1,33 @@
+using System;\r
+using System.Reflection;\r
+using System.Resources;\r
+using System.Runtime.CompilerServices;\r
+using System.Runtime.InteropServices;\r
+\r
+// General Information about an assembly is controlled through the following \r
+// set of attributes. Change these attribute values to modify the information\r
+// associated with an assembly.\r
+[assembly: AssemblyTitle("ClangFormat")]\r
+[assembly: AssemblyDescription("")]\r
+[assembly: AssemblyConfiguration("")]\r
+[assembly: AssemblyCompany("LLVM")]\r
+[assembly: AssemblyProduct("ClangFormat")]\r
+[assembly: AssemblyCopyright("")]\r
+[assembly: AssemblyTrademark("")]\r
+[assembly: AssemblyCulture("")]\r
+[assembly: ComVisible(false)]\r
+[assembly: CLSCompliant(false)]\r
+[assembly: NeutralResourcesLanguage("en-US")]\r
+\r
+// Version information for an assembly consists of the following four values:\r
+//\r
+//      Major Version\r
+//      Minor Version \r
+//      Build Number\r
+//      Revision\r
+//\r
+// You can specify all the values or you can default the Revision and Build Numbers \r
+// by using the '*' as shown below:\r
+// FIXME: Add a way to have this generated automatically by CMake\r
+[assembly: AssemblyVersion("1.1.0.0")]\r
+[assembly: AssemblyFileVersion("1.1.0.0")]\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources.Designer.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources.Designer.cs
new file mode 100644 (file)
index 0000000..b601fb3
--- /dev/null
@@ -0,0 +1,81 @@
+//------------------------------------------------------------------------------\r
+// <auto-generated>\r
+//     This code was generated by a tool.\r
+//     Runtime Version:4.0.30319.42000\r
+//\r
+//     Changes to this file may cause incorrect behavior and will be lost if\r
+//     the code is regenerated.\r
+// </auto-generated>\r
+//------------------------------------------------------------------------------\r
+\r
+namespace LLVM.ClangTidy {\r
+    using System;\r
+    \r
+    \r
+    /// <summary>\r
+    ///   A strongly-typed resource class, for looking up localized strings, etc.\r
+    /// </summary>\r
+    // This class was auto-generated by the StronglyTypedResourceBuilder\r
+    // class via a tool like ResGen or Visual Studio.\r
+    // To add or remove a member, edit your .ResX file then rerun ResGen\r
+    // with the /str option, or rebuild your VS project.\r
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]\r
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r
+    internal class Resources {\r
+        \r
+        private static global::System.Resources.ResourceManager resourceMan;\r
+        \r
+        private static global::System.Globalization.CultureInfo resourceCulture;\r
+        \r
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]\r
+        internal Resources() {\r
+        }\r
+        \r
+        /// <summary>\r
+        ///   Returns the cached ResourceManager instance used by this class.\r
+        /// </summary>\r
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r
+        internal static global::System.Resources.ResourceManager ResourceManager {\r
+            get {\r
+                if (object.ReferenceEquals(resourceMan, null)) {\r
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LLVM.ClangTidy.Resources", typeof(Resources).Assembly);\r
+                    resourceMan = temp;\r
+                }\r
+                return resourceMan;\r
+            }\r
+        }\r
+        \r
+        /// <summary>\r
+        ///   Overrides the current thread's CurrentUICulture property for all\r
+        ///   resource lookups using this strongly typed resource class.\r
+        /// </summary>\r
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r
+        internal static global::System.Globalization.CultureInfo Culture {\r
+            get {\r
+                return resourceCulture;\r
+            }\r
+            set {\r
+                resourceCulture = value;\r
+            }\r
+        }\r
+        \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to ---\r
+        ///Checks:\r
+        ///Checks:\r
+        ///  - Name:        cert-dcl54-cpp\r
+        ///    Label:       Overloaded allocation function pairs\r
+        ///    Description: Checks for violations of CERT DCL54-CPP - Overload allocation and deallocation functions as a pair in the same scope\r
+        ///    Category:    CERT Secure Coding Standards\r
+        ///  - Name:        cppcoreguidelines-interfaces-global-init\r
+        ///    Label:       I.22 - Complex Global Initializers\r
+        ///    Description: Checks for violations of Core Guideline I.22 - Avoid complex initializers of global object [rest of string was truncated]&quot;;.\r
+        /// </summary>\r
+        internal static string ClangTidyChecks {\r
+            get {\r
+                return ResourceManager.GetString("ClangTidyChecks", resourceCulture);\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources.resx b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources.resx
new file mode 100644 (file)
index 0000000..7f63475
--- /dev/null
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+  <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 2.0\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">2.0</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        <value>[base64 mime encoded serialized .NET Framework object]</value>\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r
+        <comment>This is a comment</comment>\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used for serialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />\r
+    <xsd:element name="root" msdata:IsDataSet="true">\r
+      <xsd:complexType>\r
+        <xsd:choice maxOccurs="unbounded">\r
+          <xsd:element name="metadata">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" use="required" type="xsd:string" />\r
+              <xsd:attribute name="type" type="xsd:string" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="assembly">\r
+            <xsd:complexType>\r
+              <xsd:attribute name="alias" type="xsd:string" />\r
+              <xsd:attribute name="name" type="xsd:string" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="data">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />\r
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="resheader">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+        </xsd:choice>\r
+      </xsd:complexType>\r
+    </xsd:element>\r
+  </xsd:schema>\r
+  <resheader name="resmimetype">\r
+    <value>text/microsoft-resx</value>\r
+  </resheader>\r
+  <resheader name="version">\r
+    <value>2.0</value>\r
+  </resheader>\r
+  <resheader name="reader">\r
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <resheader name="writer">\r
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />\r
+  <data name="ClangTidyChecks" type="System.Resources.ResXFileRef, System.Windows.Forms">\r
+    <value>Resources\ClangTidyChecks.yaml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>\r
+  </data>\r
+</root>
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
new file mode 100644 (file)
index 0000000..fc16d23
--- /dev/null
@@ -0,0 +1,325 @@
+---\r
+Checks:\r
+   # This file should be updated when new checks are added, and eventually we should\r
+   # generate this file automatically from the .rst files in clang-tidy.\r
+  - Category:    CERT Secure Coding Standards\r
+    Label:       Overloaded allocation function pairs\r
+    Description: Checks for violations of CERT DCL54-CPP - Overload allocation and deallocation functions as a pair in the same scope\r
+    Name:        cert-dcl54-cpp\r
+  - Category:    C++ Core Guidelines\r
+    Label:       I.22 - Complex Global Initializers\r
+    Description: Checks for violations of Core Guideline I.22 - Avoid complex initializers of global objects\r
+    Name:        cppcoreguidelines-interfaces-global-init\r
+  - Category:    CERT Secure Coding Standards\r
+    Label:       DCL50-CPP\r
+    Description: Checks for violations of CERT DCL50-CPP - Do not define a C-style variadic function\r
+    Name:        cert-dcl50-cpp\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Bounds.1 - No pointer arithmetic\r
+    Description: Checks for violations of Core Guideline Bounds.3 - Don't use pointer arithmetic.  Use span<> instead.\r
+    Name:        cppcoreguidelines-pro-bounds-pointer-arithmetic\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Bounds.2 - Constant array indices\r
+    Description: Checks for violations of Core Bounds.2 - Only index into arrays using constant expressions.\r
+    Name:        cppcoreguidelines-pro-bounds-constant-array-index\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Bounds.3 - Array to Pointer Decay\r
+    Description: Checks for violations of Core Guideline Bounds.3 - No array-to-pointer decay\r
+    Name:        cppcoreguidelines-pro-bounds-array-to-pointer-decay\r
+  - Category:    C++ Core Guidelines\r
+    Label:       const_cast (Type.3)\r
+    Description: Checks for violations of Core Guideline Type.3 - Don't use const_cast to cast away const\r
+    Name:        cppcoreguidelines-pro-type-const-cast\r
+  - Category:    C++ Core Guidelines\r
+    Label: C style casts (Type.4)\r
+    Description: Checks for violations of Core Guideline Type.3 - Don't use C-style (T)expression casts that would perform a static downcast, const_cast, or reinterpret_cast\r
+    Name:        cppcoreguidelines-pro-type-cstyle-cast\r
+  - Category:    C++ Core Guidelines\r
+    Label:       reinterpret_cast (Type.1)\r
+    Description: Checks for violations of Core Guideline Type.1 - Don't use reinterpret_cast.\r
+    Name:        cppcoreguidelines-pro-type-reinterpret-cast\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Prefer dynamic_cast (Type.2)\r
+    Description: Checks for violations of Core Guideline Type.2 - Don't use static_cast downcasts.  Use dynamic_cast instead.\r
+    Name:        cppcoreguidelines-pro-type-static-cast-downcast\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Member variable initialization (Type.6)\r
+    Description: Checks for violations of Core Guideline Type.6 - Always initialize a member variable.\r
+    Name:        cppcoreguidelines-pro-type-member-init\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Avoid unions (Type.7)\r
+    Description: Checks for violations of Core Guideline Type.7 - Avoid accessing members of raw unions.  Use variant instead.\r
+    Name:        cppcoreguidelines-pro-type-union-access\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Don't use varargs (Type.8)\r
+    Description: Checks for violations of Core Guideline Type.8 - Avoid reading varargs or passing vararg arguments.  Prefer variadic templates instead.\r
+    Name:        cppcoreguidelines-pro-type-vararg\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Don't slice (ES.63 & C.145)\r
+    Description: Checks for violations of Core Guidelines ES.63 (Don't slice) and C.145 (Access polymorphic objects through pointers and references)\r
+    Name:        cppcoreguidelines-slicing\r
+  - Category:    C++ Core Guidelines\r
+    Label:       Detect unsafe special functions (C.21)\r
+    Description: Checks for violations of Core Guidelines C.21 - If you define or =delete any default operation, define or =delete them all.\r
+    Name:        cppcoreguidelines-special-member-functions\r
+  - Category:    Google Style Guide\r
+    Label:       Forbid explicitly parameterized make_pair\r
+    Description: \r
+    Name:        google-build-explicit-make-pair\r
+  - Category:    Google Style Guide\r
+    Label:       Anonymous namespace in headers\r
+    Description: \r
+    Name:        google-build-namespaces\r
+  - Category:    Google Style Guide\r
+    Label:       Find using namespace directives\r
+    Description: \r
+    Name:        google-build-using-namespace\r
+  - Category:    Google Style Guide\r
+    Label:       Default arguments in virtual methods\r
+    Description: \r
+    Name:        google-default-arguments\r
+  - Category:    Google Style Guide\r
+    Label:       explicit constructors\r
+    Description: \r
+    Name:        google-explicit-constructor\r
+  - Category:    Google Style Guide\r
+    Label:       Global namespace pollution in headers\r
+    Description: \r
+    Name:        google-global-names-in-headers\r
+  - Category:    Google Style Guide\r
+    Label:       Braces around statements\r
+    Description: \r
+    Name:        google-readability-braces-around-statements\r
+  - Category:    Google Style Guide\r
+    Label:       No C-style casts\r
+    Description: \r
+    Name:        google-readability-casting\r
+  - Category:    Google Style Guide\r
+    Label:       Find large functions\r
+    Description: \r
+    Name:        google-readability-function-size\r
+  - Category:    Google Style Guide\r
+    Label:       Namespace closing comments\r
+    Description: \r
+    Name:        google-readability-namespace-comments\r
+  - Category:    Google Style Guide\r
+    Label:       Find unnecessary calls to .get()\r
+    Description: \r
+    Name:        google-readability-redundant-smartptr-get\r
+  - Category:    Google Style Guide\r
+    Label:       Find noncomformant TODO comments\r
+    Description: \r
+    Name:        google-readability-todo\r
+  - Category:    Google Style Guide\r
+    Label:       Find implementation-specific integral types\r
+    Description: \r
+    Name:        google-runtime-int\r
+  - Category:    Google Style Guide\r
+    Label:       Find const string references\r
+    Description: \r
+    Name:        google-runtime-member-string-references\r
+  - Category:    Google Style Guide\r
+    Label:       Find zero-length memsets\r
+    Description: \r
+    Name:        google-runtime-memset\r
+  - Category:    Google Style Guide\r
+    Label:       Find overloads of operator&\r
+    Description: \r
+    Name:        google-runtime-operator\r
+  - Category:    Google Style Guide\r
+    Label:       Check usage of non-const references\r
+    Description: \r
+    Name:        google-runtime-references\r
+  - Category:    LLVM Style Guide\r
+    Label:       LLVM header guards\r
+    Description: \r
+    Name:        llvm-header-guard\r
+  - Category:    LLVM Style Guide\r
+    Label:       LLVM include order\r
+    Description: \r
+    Name:        llvm-include-order\r
+  - Category:    LLVM Style Guide\r
+    Label:       LLVM namespace comments\r
+    Description: \r
+    Name:        llvm-namespace-comment\r
+  - Category:    LLVM Style Guide\r
+    Label:       Find local twines\r
+    Description: \r
+    Name:        llvm-twine-local\r
+  - Category:    Clang Diagnostics\r
+    Label:       Warnings\r
+    Description: \r
+    Name:        clang-diagnostic-warning\r
+  - Category:    Clang Diagnostics\r
+    Label:       Errors\r
+    Description: \r
+    Name:        clang-diagnostic-error\r
+  - Category:    Clang Diagnostics\r
+    Label:       Unknown\r
+    Description: \r
+    Name:        clang-diagnostic-unknown\r
+  - Category:    Miscellaneous\r
+    Label:       Validate argument comments\r
+    Description: \r
+    Name:        misc-argument-comment\r
+  - Category:    Miscellaneous\r
+    Label:       Side effects in assert()\r
+    Description: \r
+    Name:        misc-assert-side-effect\r
+  - Category:    Miscellaneous\r
+    Label:       bool / pointer implicit conversions\r
+    Description: \r
+    Name:        misc-bool-pointer-implicit-conversion\r
+  - Category:    Miscellaneous\r
+    Label:       Dangling handles\r
+    Description: \r
+    Name:        misc-dangling-handle\r
+  - Category:    Miscellaneous\r
+    Label:       Definitions in headers\r
+    Description: \r
+    Name:        misc-definitions-in-headers\r
+  - Category:    Miscellaneous\r
+    Label:       Type mismatch in fold operations\r
+    Description: \r
+    Name:        misc-fold-init-type\r
+  - Category:    Miscellaneous\r
+    Label:       Forward declaration namespace\r
+    Description: \r
+    Name:        misc-forward-declaration-namespace\r
+  - Category:    Miscellaneous\r
+    Label:       Inaccurate erase\r
+    Description: \r
+    Name:        misc-inaccurate-erase\r
+  - Category:    Miscellaneous\r
+    Label:       Incorrect rounding\r
+    Description: \r
+    Name:        misc-incorrect-roundings\r
+  - Category:    Miscellaneous\r
+    Label:       Inefficient STL algorithms\r
+    Description: \r
+    Name:        misc-inefficient-algorithm\r
+  - Category:    Miscellaneous\r
+    Label:       Macro parentheses\r
+    Description: \r
+    Name:        misc-macro-parentheses\r
+  - Category:    Miscellaneous\r
+    Label:       Macro repeated side effects\r
+    Description: \r
+    Name:        misc-macro-repeated-side-effects\r
+  - Category:    Miscellaneous\r
+    Label:       Misplaced const\r
+    Description: \r
+    Name:        misc-misplaced-const\r
+  - Category:    Miscellaneous\r
+    Label:       Misplaced widening casts\r
+    Description: \r
+    Name:        misc-misplaced-widening-cast\r
+  - Category:    Miscellaneous\r
+    Label:       Move constructor const arguments\r
+    Description: \r
+    Name:        misc-move-const-arg\r
+  - Category:    Miscellaneous\r
+    Label:       Move constructor initialization\r
+    Description: \r
+    Name:        misc-move-constructor-init\r
+  - Category:    Miscellaneous\r
+    Label:       Multi-statement macros\r
+    Description: \r
+    Name:        misc-multiple-statement-macro\r
+  - Category:    Miscellaneous\r
+    Label:       Verify new / delete overloads\r
+    Description: \r
+    Name:        misc-new-delete-overloads\r
+  - Category:    Miscellaneous\r
+    Label:       Ensure move constructors are noexcept\r
+    Description: \r
+    Name:        misc-noexcept-move-constructor\r
+  - Category:    Miscellaneous\r
+    Label:       Copying of non-copyable objects\r
+    Description: \r
+    Name:        misc-non-copyable-objects\r
+  - Category:    Miscellaneous\r
+    Label:       Suspicious pointer / integer operations\r
+    Description: \r
+    Name:        misc-pointer-and-integral-operation\r
+  - Category:    Miscellaneous\r
+    Label:       Find redundant expressions\r
+    Description: \r
+    Name:        misc-redundant-expression\r
+  - Category:    Miscellaneous\r
+    Label:       sizeof() on stl containers\r
+    Description: \r
+    Name:        misc-sizeof-container\r
+  - Category:    Miscellaneous\r
+    Label:       Suspicious sizeof() usage\r
+    Description: \r
+    Name:        misc-sizeof-expression\r
+  - Category:    Miscellaneous\r
+    Label:       Replace assert with static_assert\r
+    Description: \r
+    Name:        misc-static-assert\r
+  - Category:    Miscellaneous\r
+    Label:       Suspicious string constructor\r
+    Description: \r
+    Name:        misc-string-constructor\r
+  - Category:    Miscellaneous\r
+    Label:       String integer assignment\r
+    Description: \r
+    Name:        misc-string-integer-assignment\r
+  - Category:    Miscellaneous\r
+    Label:       String literal with embedded null\r
+    Description: \r
+    Name:        misc-string-literal-with-embedded-nul\r
+  - Category:    Miscellaneous\r
+    Label:       Suspicious missing comma\r
+    Description: \r
+    Name:        misc-suspicious-missing-comma\r
+  - Category:    Miscellaneous\r
+    Label:       Suspicious semicolon\r
+    Description: \r
+    Name:        misc-suspicious-semicolon\r
+  - Category:    Miscellaneous\r
+    Label:       Suspicious string compare\r
+    Description: \r
+    Name:        misc-suspicious-string-compare\r
+  - Category:    Miscellaneous\r
+    Label:       Swapped arguments\r
+    Description: \r
+    Name:        misc-swapped-arguments\r
+  - Category:    Miscellaneous\r
+    Label:       Throw by value / catch by reference\r
+    Description: \r
+    Name:        misc-throw-by-value-catch-by-reference\r
+  - Category:    Miscellaneous\r
+    Label:       Unconventional operator=()\r
+    Description: \r
+    Name:        misc-unconventional-assign-operator\r
+  - Category:    Miscellaneous\r
+    Label:       Undelegated constructor\r
+    Description: \r
+    Name:        misc-undelegated-constructor\r
+  - Category:    Miscellaneous\r
+    Label:       unique_ptr<> reset / release\r
+    Description: \r
+    Name:        misc-uniqueptr-reset-release\r
+  - Category:    Miscellaneous\r
+    Label:       Unused Alias Decls\r
+    Description: \r
+    Name:        misc-unused-alias-decls\r
+  - Category:    Miscellaneous\r
+    Label:       Unused Params\r
+    Description: \r
+    Name:        misc-unused-parameters\r
+  - Category:    Miscellaneous\r
+    Label:       Unused Raii\r
+    Description: \r
+    Name:        misc-unused-raii\r
+  - Category:    Miscellaneous\r
+    Label:       Unused Using Decls\r
+    Description: \r
+    Name:        misc-unused-using-decls\r
+  - Category:    Miscellaneous\r
+    Label:       Virtual Near Miss\r
+    Description: \r
+    Name:        misc-virtual-near-miss\r
+...\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Images_32bit.bmp b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Images_32bit.bmp
new file mode 100644 (file)
index 0000000..2fa7ab0
Binary files /dev/null and b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Images_32bit.bmp differ
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Package.ico b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Package.ico
new file mode 100644 (file)
index 0000000..ea3b23f
Binary files /dev/null and b/clang-tools-extra/clang-tidy-vs/ClangTidy/Resources/Package.ico differ
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/Utility.cs b/clang-tools-extra/clang-tidy-vs/ClangTidy/Utility.cs
new file mode 100644 (file)
index 0000000..5a220e6
--- /dev/null
@@ -0,0 +1,35 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.IO;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Text.RegularExpressions;\r
+using System.Threading.Tasks;\r
+\r
+namespace LLVM.ClangTidy\r
+{\r
+    static class Utility\r
+    {\r
+        public static IEnumerable<string> SplitPath(string FileOrDir)\r
+        {\r
+            string P = Path.GetDirectoryName(FileOrDir);\r
+            do\r
+            {\r
+                yield return P;\r
+                P = Path.GetDirectoryName(P);\r
+            } while (P != null);\r
+        }\r
+\r
+        public static bool HasClangTidyFile(string Folder)\r
+        {\r
+            string ClangTidy = Path.Combine(Folder, ".clang-tidy");\r
+            return File.Exists(ClangTidy);\r
+        }\r
+\r
+        public static bool MatchWildcardString(string Value, string Pattern)\r
+        {\r
+            string RE = Regex.Escape(Pattern).Replace(@"\*", ".*");\r
+            return Regex.IsMatch(Value, RE);\r
+        }\r
+    }\r
+}\r
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/VSPackage.resx b/clang-tools-extra/clang-tidy-vs/ClangTidy/VSPackage.resx
new file mode 100644 (file)
index 0000000..932b062
--- /dev/null
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+  <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 2.0\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">2.0</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        <value>[base64 mime encoded serialized .NET Framework object]</value>\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r
+        <comment>This is a comment</comment>\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used for serialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />\r
+    <xsd:element name="root" msdata:IsDataSet="true">\r
+      <xsd:complexType>\r
+        <xsd:choice maxOccurs="unbounded">\r
+          <xsd:element name="metadata">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" use="required" type="xsd:string" />\r
+              <xsd:attribute name="type" type="xsd:string" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="assembly">\r
+            <xsd:complexType>\r
+              <xsd:attribute name="alias" type="xsd:string" />\r
+              <xsd:attribute name="name" type="xsd:string" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="data">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />\r
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="resheader">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+        </xsd:choice>\r
+      </xsd:complexType>\r
+    </xsd:element>\r
+  </xsd:schema>\r
+  <resheader name="resmimetype">\r
+    <value>text/microsoft-resx</value>\r
+  </resheader>\r
+  <resheader name="version">\r
+    <value>2.0</value>\r
+  </resheader>\r
+  <resheader name="reader">\r
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <resheader name="writer">\r
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <data name="110" xml:space="preserve">\r
+    <value>ClangTidy</value>\r
+  </data>\r
+  <data name="112" xml:space="preserve">\r
+    <value>Analyzes code by calling the clang-tidy executable.</value>\r
+  </data>\r
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />\r
+  <data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">\r
+    <value>Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>\r
+  </data>\r
+</root>
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/license.txt b/clang-tools-extra/clang-tidy-vs/ClangTidy/license.txt
new file mode 100644 (file)
index 0000000..b452ca2
--- /dev/null
@@ -0,0 +1,63 @@
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007-2016 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+    LLVM Team
+
+    University of Illinois at Urbana-Champaign
+
+    http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimers.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimers in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the names of the LLVM Team, University of Illinois at
+      Urbana-Champaign, nor the names of its contributors may be used to
+      endorse or promote products derived from this Software without specific
+      prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+The LLVM software contains code written by third parties.  Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+The following pieces of software have additional or alternate copyrights,
+licenses, and/or restrictions:
+
+Program             Directory
+-------             ---------
+<none yet>
+
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/packages.config b/clang-tools-extra/clang-tidy-vs/ClangTidy/packages.config
new file mode 100644 (file)
index 0000000..75d7faf
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<packages>\r
+  <package id="Brutal.Dev.StrongNameSigner" version="1.8.0" targetFramework="net45" />\r
+  <package id="YamlDotNet" version="3.3.0" targetFramework="net45" />\r
+  <package id="YamlDotNet.Dynamic" version="3.2.3" targetFramework="net45" />\r
+</packages>
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy-vs/ClangTidy/source.extension.vsixmanifest b/clang-tools-extra/clang-tidy-vs/ClangTidy/source.extension.vsixmanifest
new file mode 100644 (file)
index 0000000..cd0e863
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Vsix Version="1.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">\r
+  <Identifier Id="405594C3-042A-4155-B9A6-E25DAB8B1924">\r
+    <Name>ClangFormat</Name>\r
+    <Author>LLVM</Author>\r
+    <Version>4.0.0</Version>\r
+    <Description xml:space="preserve">A static analysis tool for C/C++ code.</Description>\r
+    <Locale>1033</Locale>\r
+    <MoreInfoUrl>http://clang.llvm.org/extra/clang-tidy/</MoreInfoUrl>\r
+    <License>license.txt</License>\r
+    <InstalledByMsi>false</InstalledByMsi>\r
+    <SupportedProducts>\r
+      <VisualStudio Version="10.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+      <VisualStudio Version="11.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+      <VisualStudio Version="12.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+      <VisualStudio Version="14.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+    </SupportedProducts>\r
+    <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />\r
+  </Identifier>\r
+  <References>\r
+        <Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">\r
+            <Name>Visual Studio MPF</Name>\r
+        </Reference>\r
+  </References>\r
+  <Content>\r
+    <VsPackage>|%CurrentProject%;PkgdefProjectOutputGroup|</VsPackage>\r
+  </Content>\r
+</Vsix>\r
diff --git a/clang-tools-extra/clang-tidy-vs/README.txt b/clang-tools-extra/clang-tidy-vs/README.txt
new file mode 100644 (file)
index 0000000..d8785c9
--- /dev/null
@@ -0,0 +1,17 @@
+This directory contains a VSPackage project to generate a Visual Studio extension\r
+for clang-tidy.\r
+\r
+Build prerequisites are:\r
+- Visual Studio 2013 Professional\r
+- Visual Studio 2013 SDK\r
+- Visual Studio 2010 Professional (?)\r
+- Visual Studio 2010 SDK (?)\r
+\r
+The extension is built using CMake by setting BUILD_CLANG_TIDY_VS_PLUGIN=ON\r
+when configuring a Clang build, and building the clang_tidy_vsix target.\r
+\r
+The CMake build will copy clang-tidy.exe and LICENSE.TXT into the ClangTidy/\r
+directory so they can be bundled with the plug-in, as well as creating\r
+ClangTidy/source.extension.vsixmanifest. Once the plug-in has been built with\r
+CMake once, it can be built manually from the ClangTidy.sln solution in Visual\r
+Studio.\r
diff --git a/clang-tools-extra/clang-tidy-vs/source.extension.vsixmanifest.in b/clang-tools-extra/clang-tidy-vs/source.extension.vsixmanifest.in
new file mode 100644 (file)
index 0000000..6b47097
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Vsix Version="1.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">\r
+  <Identifier Id="405594C3-042A-4155-B9A6-E25DAB8B1924">\r
+    <Name>ClangFormat</Name>\r
+    <Author>LLVM</Author>\r
+    <Version>@CLANG_TIDY_VS_VERSION@</Version>\r
+    <Description xml:space="preserve">A static analysis tool for C/C++ code.</Description>\r
+    <Locale>1033</Locale>\r
+    <MoreInfoUrl>http://clang.llvm.org/extra/clang-tidy/</MoreInfoUrl>\r
+    <License>license.txt</License>\r
+    <InstalledByMsi>false</InstalledByMsi>\r
+    <SupportedProducts>\r
+      <VisualStudio Version="10.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+      <VisualStudio Version="11.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+      <VisualStudio Version="12.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+      <VisualStudio Version="14.0">\r
+        <Edition>Pro</Edition>\r
+      </VisualStudio>\r
+    </SupportedProducts>\r
+    <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />\r
+  </Identifier>\r
+  <References>\r
+        <Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">\r
+            <Name>Visual Studio MPF</Name>\r
+        </Reference>\r
+  </References>\r
+  <Content>\r
+    <VsPackage>|%CurrentProject%;PkgdefProjectOutputGroup|</VsPackage>\r
+  </Content>\r
+</Vsix>\r