Skip to content

[libc][cmake] Report invalid clang-tidy path #66475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,17 @@ if(LLVM_LIBC_ENABLE_LINTING)
if(LLVM_LIBC_CLANG_TIDY)
# Check clang-tidy major version.
execute_process(COMMAND ${LLVM_LIBC_CLANG_TIDY} "--version"
OUTPUT_VARIABLE CLANG_TIDY_OUTPUT)
OUTPUT_VARIABLE CLANG_TIDY_OUTPUT
ERROR_VARIABLE CLANG_TIDY_ERROR
RESULT_VARIABLE CLANG_TIDY_RESULT)

if(CLANG_TIDY_RESULT AND NOT CLANG_TIDY_RESULT EQUAL 0)
message(FATAL_ERROR "Failed to execute '${LLVM_LIBC_CLANG_TIDY} --version'
output : '${CLANG_TIDY_OUTPUT}'
error : '${CLANG_TIDY_ERROR}'
result : '${CLANG_TIDY_RESULT}'
")
endif()
string(REGEX MATCH "[0-9]+" CLANG_TIDY_VERSION "${CLANG_TIDY_OUTPUT}")
string(REGEX MATCH "[0-9]+" CLANG_MAJOR_VERSION
"${CMAKE_CXX_COMPILER_VERSION}")
Expand Down