blob: 5a220e6ba15786ea91cd0f0b9c6611e8f677ddf9 [file] [log] [blame]
Zachary Turner1122be82016-09-07 18:28:55 +00001using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using System.Text;
6using System.Text.RegularExpressions;
7using System.Threading.Tasks;
8
9namespace 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}