Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WORK IN PROGRESS
Related to DARMA-tasking/vt#874
How to build this check
See
Dockerfile
for general reference on how to build the LLVM. Minimal cmake configuration I used for development:Bonus, if you're using vscode:
Testing
Code snippets used for
misc-redundant-const-refs
testing can be found in:clang-tools-extra/test/clang-tidy/checkers/misc/redundant-const-refs.cpp
To run
misc-redundant-const-refs
test:export PATH
makes sure that compiled clang-tidy 1) is in the path, 2) will be found before system clang-tidy (if exists).In case of an error
No such file or directory: 'FileCheck'
, copyFileCheck
from<llvm-build-path>/bin
to<llvm-installation-path>/bin
Docker image publishing
Originally every change done within this PR would trigger building and publishing images to my docker hub containing compiled clang-tidy, later used by DARMA-tasking/vt#1875, but because back then this PR occupied my own fork, it should be changed after moving it to DARMA-tasking, and the docker image should be published on DARMA docker hub.
Links that (IMHO) matter
Contributing to LLVM
https://llvm.org/docs/Contributing.html
Clang doxygen
https://clang.llvm.org/doxygen/
AST Matcher Reference
https://clang.llvm.org/docs/LibASTMatchersReference.html
How to get started with the implementation of clang-tidy check
https://blog.audio-tk.com/2018/03/20/writing-custom-checks-for-clang-tidy/
https://www.kdab.com/clang-tidy-part-1-modernize-source-code-using-c11c14/
https://bbannier.github.io/blog/2015/05/02/Writing-a-basic-clang-static-analysis-check.html
https://docs.redpoint.games/clang-tidy-for-unreal-engine/docs/writing_custom_checks/
https://devblogs.microsoft.com/cppblog/exploring-clang-tooling-part-1-extending-clang-tidy/
https://devblogs.microsoft.com/cppblog/exploring-clang-tooling-part-2-examining-the-clang-ast-with-clang-query/
https://devblogs.microsoft.com/cppblog/exploring-clang-tooling-part-3-rewriting-code-with-clang-tidy/
https://firefox-source-docs.mozilla.org/code-quality/static-analysis/writing-new/clang-query.html
https://eli.thegreenplace.net/2014/07/29/ast-matchers-and-clang-refactoring-tools
https://www.youtube.com/watch?v=VqCkCDFLSsc
https://www.youtube.com/watch?v=K-WhaEUEZWc
https://www.youtube.com/watch?v=UfLH7dORav8