Open
Conversation
added 13 commits
November 16, 2022 21:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Dockerfilefor general reference on how to build the LLVM. Minimal cmake configuration I used for development:Bonus, if you're using vscode:
{ "cmake.buildDirectory": "<build-path>-${buildType}", "cmake.configureSettings": { "CLANG_TIDY_ENABLE_STATIC_ANALYZER": "ON", "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", "CMAKE_C_COMPILER_LAUNCHER": "ccache", "CMAKE_VERBOSE_MAKEFILE": 0, "LLVM_ENABLE_PROJECTS": ["clang", "clang-tools-extra"], "LLVM_TARGETS_TO_BUILD": "X86", "LLVM_USE_LINKER": "lld" }, "cmake.installPrefix": "<installation-path>-${buildType}", "cmake.sourceDirectory": "${workspaceFolder}/llvm" }Testing
Code snippets used for
misc-redundant-const-refstesting can be found in:clang-tools-extra/test/clang-tidy/checkers/misc/redundant-const-refs.cppTo run
misc-redundant-const-refstest:export PATHmakes 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', copyFileCheckfrom<llvm-build-path>/binto<llvm-installation-path>/binDocker 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