Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Donald Chen
pc-ble-driver-sd_api_v6
Commits
f89f8104
Commit
f89f8104
authored
Aug 06, 2018
by
bencefr
Browse files
Add support to clang-tidy
parent
db8a8d54
Changes
2
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
f89f8104
...
...
@@ -137,4 +137,8 @@ foreach(SD_API_VER ${SD_API_VERS})
endforeach
(
SD_API_VER
)
# Add tests
add_subdirectory
(
test
)
\ No newline at end of file
add_subdirectory
(
test
)
include
(
cmake/clang-dev-tools.cmake
)
cmake/clang-dev-tools.cmake
0 → 100644
View file @
f89f8104
if
(
WIN32
)
# CMAKE_EXPORT_COMPILE_COMMANDS is not working on Windows
message
(
clang-tidy is not supported on Windows
)
# For the target not to fail:
add_custom_target
(
tidy COMMAND echo
"not supported on Windows"
)
else
()
find_program
(
CLANG_TIDY run-clang-tidy.py
)
if
(
NOT CLANG_TIDY
)
message
(
STATUS
"Did not find clang-tidy, target tidy is disabled."
)
message
(
STATUS
"If clang-tidy is installed, make sure run-clang-tidy.py is in PATH"
)
# For the target not to fail:
add_custom_target
(
tidy COMMAND echo
"Clang-tidy is not installed"
)
else
()
message
(
STATUS
"Found clang-tidy, use
\"
make tidy
\"
to run it."
)
# This will create build/compile_commands.json
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
set
(
CLANG_TIDY_CHECKS
"*"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-llvm-header-guard"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-llvm-include-order"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-llvm-namespace-comment"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-readability-else-after-return"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-misc-macro-parentheses"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-clang-analyzer-alpha.core.CastToStruct"
)
# Modernize
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-modernize-raw-string-literal"
)
# CPP Core Guidelines
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-cppcoreguidelines-pro-bounds-array-to-pointer-decay"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-cppcoreguidelines-pro-bounds-constant-array-index"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-cppcoreguidelines-pro-bounds-pointer-arithmetic"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-cppcoreguidelines-pro-type-member-init"
)
# as of https://llvm.org/bugs/show_bug.cgi?id=31039
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-cppcoreguidelines-pro-type-reinterpret-cast"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-cppcoreguidelines-pro-type-vararg"
)
# Google
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-google-readability-namespace-comments"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-google-readability-braces-around-statements,-readability-braces-around-statements"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-google-readability-todo"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-google-runtime-int"
)
set
(
CLANG_TIDY_CHECKS
"
${
CLANG_TIDY_CHECKS
}
,-google-runtime-references"
)
set
(
CLANG_TIDY_CHECKS
"-checks='
${
CLANG_TIDY_CHECKS
}
'"
)
add_custom_target
(
tidy
COMMAND
${
CLANG_TIDY
}
${
CLANG_TIDY_CHECKS
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/build/
)
endif
()
endif
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment