diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2014-03-18 04:46:45 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2014-03-18 04:46:45 +0000 |
commit | 35c3f61d749d78917ee572f672c89993692047b9 (patch) | |
tree | 75813f26078a3f71cf28c2174676e7c9ffcdd1c7 /clang-tools-extra/unittests/clang-tidy/CMakeLists.txt | |
parent | 47a35dfd7cfcffe67e6cb716696d855970d0eb1f (diff) | |
download | bcm5719-llvm-35c3f61d749d78917ee572f672c89993692047b9.tar.gz bcm5719-llvm-35c3f61d749d78917ee572f672c89993692047b9.zip |
Add an argument comment checker to clang-tidy.
This checks that parameters named in comments that appear before arguments in
function and constructor calls match the parameter name used in the callee's
declaration. For example:
void f(int x, int y);
void g() {
f(/*y=*/0, /*z=*/0);
}
contains two violations of the policy, as the names 'x' and 'y' used in the
declaration do not match names 'y' and 'z' used at the call site.
I think there is significant value in being able to check/enforce this policy
as a way of guarding against accidental API misuse and silent breakages
caused by API changes.
Although this pattern appears somewhat frequently in the LLVM codebase,
this policy is not prescribed by the LLVM coding standards at the moment,
so it lives under 'misc'.
Differential Revision: http://llvm-reviews.chandlerc.com/D2914
llvm-svn: 204113
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/CMakeLists.txt')
-rw-r--r-- | clang-tools-extra/unittests/clang-tidy/CMakeLists.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt index 2778571789d..5d29b0f9e8f 100644 --- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt +++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt @@ -8,7 +8,8 @@ include_directories(${CLANG_LINT_SOURCE_DIR}) add_extra_unittest(ClangTidyTests LLVMModuleTest.cpp - GoogleModuleTest.cpp) + GoogleModuleTest.cpp + MiscModuleTest.cpp) target_link_libraries(ClangTidyTests clangAST @@ -18,5 +19,6 @@ target_link_libraries(ClangTidyTests clangTidy clangTidyGoogleModule clangTidyLLVMModule + clangTidyMiscModule clangTooling ) |