Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTue Ly <lntue@google.com>2022-02-07 19:46:09 +0300
committerTue Ly <lntue@google.com>2022-03-01 19:04:29 +0300
commit4816bfa83881f4a34eb95d6c7a47258c7e49ef71 (patch)
tree41e04f30c07437d7587e450cff6328bec5cd3b08 /libc/cmake/modules/LLVMLibCObjectRules.cmake
parentac616fbb05b8c0e8f85144d54d5295d2d663c5b7 (diff)
[libc] Add LLVM_LIBC_CLANG_TIDY option and allow LLVM_LIBC_ENABLE_LINTING without full build.
Add LLVM_LIBC_CLANG_TIDY option and allow LLVM_LIBC_ENABLE_LINTING without full build. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D119180
Diffstat (limited to 'libc/cmake/modules/LLVMLibCObjectRules.cmake')
-rw-r--r--libc/cmake/modules/LLVMLibCObjectRules.cmake13
1 files changed, 6 insertions, 7 deletions
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 0ddf8a19f589..8e2f489752a6 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -222,6 +222,10 @@ function(add_entrypoint_object target_name)
)
if(LLVM_LIBC_ENABLE_LINTING)
+ if(NOT LLVM_LIBC_CLANG_TIDY)
+ message(FATAL_ERROR "Something is wrong! LLVM_LIBC_ENABLE_LINTING is "
+ "ON but LLVM_LIBC_CLANG_TIDY is not set.")
+ endif()
# We only want a second invocation of clang-tidy to run
# restrict-system-libc-headers if the compiler-resource-dir was set in
@@ -231,7 +235,7 @@ function(add_entrypoint_object target_name)
# We run restrict-system-libc-headers with --system-headers to prevent
# transitive inclusion through compler provided headers.
set(restrict_system_headers_check_invocation
- COMMAND $<TARGET_FILE:clang-tidy> --system-headers
+ COMMAND ${LLVM_LIBC_CLANG_TIDY} --system-headers
--checks="-*,llvmlibc-restrict-system-libc-headers"
# We explicitly set the resource dir here to match the
# resource dir of the host compiler.
@@ -255,7 +259,7 @@ function(add_entrypoint_object target_name)
# X warnings generated.
# Until this is fixed upstream, we use -fno-caret-diagnostics to surpress
# these.
- COMMAND $<TARGET_FILE:clang-tidy>
+ COMMAND ${LLVM_LIBC_CLANG_TIDY}
"--extra-arg=-fno-caret-diagnostics" --quiet
# Path to directory containing compile_commands.json
-p ${PROJECT_BINARY_DIR}
@@ -274,11 +278,6 @@ function(add_entrypoint_object target_name)
DEPENDS clang-tidy ${internal_target_name} ${ADD_ENTRYPOINT_OBJ_SRCS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
-
- add_custom_target(${fq_target_name}.__lint__
- DEPENDS ${lint_timestamp})
- add_dependencies(lint-libc ${fq_target_name}.__lint__)
- add_dependencies(${fq_target_name} ${fq_target_name}.__lint__)
endif()
endfunction(add_entrypoint_object)