[libc-commits] [libc] [libc][cmake] Report invalid clang-tidy path (PR #66475)
via libc-commits
libc-commits at lists.llvm.org
Fri Sep 15 02:05:24 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
<details>
<summary>Changes</summary>
Adds better error reporting for clang-tidy.
--
Full diff: https://github.com/llvm/llvm-project/pull/66475.diff
1 Files Affected:
- (modified) libc/CMakeLists.txt (+11-1)
<pre>
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}")
</pre>
</details>
https://github.com/llvm/llvm-project/pull/66475
More information about the libc-commits
mailing list