未验证 提交 8c6533a4 编写于 作者: Q quicksilver 提交者: GitHub

Enable/Disable output of compile commands for clang-tidy (#3214)

Signed-off-by: Nquicksilver <zhifeng.zhang@zilliz.com>
上级 202a8b72
......@@ -18,7 +18,7 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,modernize-*,readability-*'
# produce HeaderFilterRegex from cpp/build-support/lint_exclusions.txt with:
# echo -n '^('; sed -e 's/*/\.*/g' cpp/build-support/lint_exclusions.txt | tr '\n' '|'; echo ')$'
HeaderFilterRegex: '^(.*cmake-build-debug.*|.*cmake-build-release.*|.*cmake_build.*|.*src/core/thirdparty.*|.*thirdparty.*|.*easylogging++.*|.*SqliteMetaImpl.cpp|.*src/grpc.*|.*src/core.*|.*src/wrapper.*)$'
HeaderFilterRegex: '^(.*core/cmake-build-debug.*|.*core/cmake-build-release.*|.*core/cmake_build.*)$'
AnalyzeTemporaryDtors: true
ChainedConditionalReturn: 1
ChainedConditionalAssignment: 1
......
......@@ -160,6 +160,13 @@ find_package( Python COMPONENTS Interpreter Development )
find_package( ClangTools )
set( BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support" )
if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
# Generate a Clang compile_commands.json "compilation database" file for use
# with various development tools, such as Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
endif()
#
# "make lint" target
#
......
......@@ -57,7 +57,7 @@ def _check_all(cmd, filenames):
if problem_files:
msg = "clang-tidy suggested fixes for {}"
print("\n".join(map(msg.format, problem_files)))
print(stdout)
print(stdout.decode("utf-8"))
error = True
except Exception:
error = True
......@@ -123,4 +123,3 @@ if __name__ == "__main__":
else:
_check_all(cmd, linted_filenames)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册