[libc-commits] [libc] c21be63 - [libc][cmake] Report invalid clang-tidy path (#66475)
via libc-commits
libc-commits at lists.llvm.org
Fri Sep 15 08:43:52 PDT 2023
Author: Guillaume Chatelet
Date: 2023-09-15T17:43:48+02:00
New Revision: c21be632280f60c870b7633e6ad7c4607662236c
URL: https://github.com/llvm/llvm-project/commit/c21be632280f60c870b7633e6ad7c4607662236c
DIFF: https://github.com/llvm/llvm-project/commit/c21be632280f60c870b7633e6ad7c4607662236c.diff
LOG: [libc][cmake] Report invalid clang-tidy path (#66475)
Adds better error reporting for missing clang-tidy.
Added:
Modified:
libc/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index f81fe01b3918741..0cec6fc07d982b4 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -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}")
More information about the libc-commits
mailing list