diff --git a/.clang-tidy b/.clang-tidy index 1695fa668541bf56dbed074b8860347985116218..492260dd0b2e118ff978b582ded491035fdec918 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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 diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index e441a906f378a78c9d98ba73ba2980dcf550fe16..c24eea0cceba321aaad0bfdc33c13a1d1d279d49 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -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 # diff --git a/core/build-support/run_clang_tidy.py b/core/build-support/run_clang_tidy.py index 6df17d5379de8b163a77f98fb71a35e09b81063b..788e7e09c2bc78520ad8fb37eb1329064a62661f 100755 --- a/core/build-support/run_clang_tidy.py +++ b/core/build-support/run_clang_tidy.py @@ -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) -