Skip to content

Commit c21be63

Browse files
authored
[libc][cmake] Report invalid clang-tidy path (#66475)
Adds better error reporting for missing clang-tidy.
1 parent 3058d29 commit c21be63

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

libc/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,17 @@ if(LLVM_LIBC_ENABLE_LINTING)
190190
if(LLVM_LIBC_CLANG_TIDY)
191191
# Check clang-tidy major version.
192192
execute_process(COMMAND ${LLVM_LIBC_CLANG_TIDY} "--version"
193-
OUTPUT_VARIABLE CLANG_TIDY_OUTPUT)
193+
OUTPUT_VARIABLE CLANG_TIDY_OUTPUT
194+
ERROR_VARIABLE CLANG_TIDY_ERROR
195+
RESULT_VARIABLE CLANG_TIDY_RESULT)
196+
197+
if(CLANG_TIDY_RESULT AND NOT CLANG_TIDY_RESULT EQUAL 0)
198+
message(FATAL_ERROR "Failed to execute '${LLVM_LIBC_CLANG_TIDY} --version'
199+
output : '${CLANG_TIDY_OUTPUT}'
200+
error : '${CLANG_TIDY_ERROR}'
201+
result : '${CLANG_TIDY_RESULT}'
202+
")
203+
endif()
194204
string(REGEX MATCH "[0-9]+" CLANG_TIDY_VERSION "${CLANG_TIDY_OUTPUT}")
195205
string(REGEX MATCH "[0-9]+" CLANG_MAJOR_VERSION
196206
"${CMAKE_CXX_COMPILER_VERSION}")

0 commit comments

Comments
 (0)