1 using System; 2 using System.Collections.Generic; 3 using System.IO; 4 using System.Linq; 5 using System.Text; 6 using System.Text.RegularExpressions; 7 using System.Threading.Tasks; 8 9 namespace LLVM.ClangTidy 10 { 11 static class Utility 12 { 13 public static IEnumerable<string> SplitPath(string FileOrDir) 14 { 15 string P = Path.GetDirectoryName(FileOrDir); 16 do 17 { 18 yield return P; 19 P = Path.GetDirectoryName(P); 20 } while (P != null); 21 } 22 23 public static bool HasClangTidyFile(string Folder) 24 { 25 string ClangTidy = Path.Combine(Folder, ".clang-tidy"); 26 return File.Exists(ClangTidy); 27 } 28 29 public static bool MatchWildcardString(string Value, string Pattern) 30 { 31 string RE = Regex.Escape(Pattern).Replace(@"\*", ".*"); 32 return Regex.IsMatch(Value, RE); 33 } 34 } 35 } 36