-
Notifications
You must be signed in to change notification settings - Fork 362
/
generate_clangtidy_resources.cmd
68 lines (58 loc) · 2.23 KB
/
generate_clangtidy_resources.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@ECHO OFF
CLS
REM customize paths for your local system
SET SCRIPT_DIR=%~dp0
SET PANDOC_DIR=C:\Program Files\Pandoc\
SET PYTHON_DIR=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\
SET LLVM_DIR=C:\Development\git\llvm-project\
REM verify paths
IF NOT EXIST "%PANDOC_DIR%" (
ECHO [ERROR] Invalid PANDOC_DIR setting
GOTO ERROR
)
IF NOT EXIST "%PYTHON_DIR%" (
ECHO [ERROR] Invalid PYTHON_DIR setting
GOTO ERROR
)
IF NOT EXIST "%LLVM_DIR%" (
ECHO [ERROR] Invalid LLVM_DIR setting
GOTO ERROR
)
IF NOT EXIST "%LLVM_DIR%build\Release\bin" (
ECHO [ERROR] You have to build LLVM first
GOTO ERROR
)
REM tool versions
"%PANDOC_DIR%pandoc.exe" -v
"%PYTHON_DIR%python.exe" -V
"%LLVM_DIR%build\Release\bin\llvm-tblgen.exe" --version
git --version
ECHO LLVM recent tag:
PUSHD "%LLVM_DIR%"
git describe
POPD
ECHO.
REM GENERATION OF RULES FROM CLANG-TIDY DOCUMENTATION (RST FILES)
ECHO [INFO] generate the new version of the rules file...
"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%clangtidy_createrules.py" rules "%LLVM_DIR%clang-tools-extra\docs\clang-tidy\checks" > "%SCRIPT_DIR%clangtidy_new.xml"
ECHO [INFO] compare the new version with the old one, extend the old XML...
"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%utils_createrules.py" comparerules "%SCRIPT_DIR%..\main\resources\clangtidy.xml" "%SCRIPT_DIR%clangtidy_new.xml" > "%SCRIPT_DIR%clangtidy-comparison.md"
REM GENERATION OF RULES FROM CLANG DIAGNOSTICS
ECHO [INFO] generate the list of diagnostics...
PUSHD "%LLVM_DIR%clang\include\clang\Basic"
"%LLVM_DIR%build\Release\bin\llvm-tblgen.exe" -dump-json "%LLVM_DIR%clang\include\clang\Basic\Diagnostic.td" > "%SCRIPT_DIR%diagnostic.json"
POPD
ECHO [INFO] generate the new version of the diagnostics file...
"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%clangtidy_createrules.py" diagnostics "%SCRIPT_DIR%diagnostic.json" > "%SCRIPT_DIR%diagnostic_new.xml"
ECHO [INFO] compare the new version with the old one, extend the old XML...
"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%utils_createrules.py" comparerules "%SCRIPT_DIR%..\main\resources\clangtidy.xml" "%SCRIPT_DIR%diagnostic_new.xml" > "%SCRIPT_DIR%diagnostic-comparison.md"
REM exit
GOTO END
:ERROR
ECHO.
ECHO [ERROR] execution failed
EXIT /B 1
:END
ECHO.
ECHO [INFO] finished succesfully
EXIT /B 0