بنقرة واحدة
add-clang-tidy-check
Creates a new Clang Tidy check in the LLVM project.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Creates a new Clang Tidy check in the LLVM project.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Orchestrate structured multi-agent code review for local changes or GitHub PRs using the peanut-review CLI, and curate existing peanut-review sessions. Use when starting or managing review sessions, or when asked to deduplicate, shorten, validate, dismiss, filter, or decide whether agent review comments are worth pushing.
Generate a weekly activity snippet from GitHub. Use when the user asks for a weekly summary, weekly snippet, status update, or "what did I do this week".
Read and write marks.md files to navigate codebases efficiently. Use when a marks.md file exists in the workspace, after significant codebase exploration, or when the user asks to document important code locations. Also use when the user says "mark it/them", "mark me", "mark this/these", "add a mark", "bookmark this/these", "save as marks", "save to marks", or otherwise asks to remember/mark code locations.
Creates or updates a human-readable directory map for the currently active workspace. Use when onboarding to a new project or when the workspace layout has changed.
استنادا إلى تصنيف SOC المهني
| name | add-clang-tidy-check |
| description | Creates a new Clang Tidy check in the LLVM project. |
Files to create:
src/clang-tools-extra/clang-tidy/<module>/<CheckName>Check.h - Header with class declarationsrc/clang-tools-extra/clang-tidy/<module>/<CheckName>Check.cpp - ImplementationKey components:
// Header
class MyCheck : public ClangTidyCheck {
public:
MyCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override;
};
// Implementation
void MyCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(/* matcher */.bind("name"), this);
}
void MyCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Node = Result.Nodes.getNodeAs<NodeType>("name");
diag(Loc, "message") << FixItHint::CreateRemoval(Range);
}
File: src/clang-tools-extra/clang-tidy/<module>/<Module>TidyModule.cpp
#include "MyCheck.h"
// ...
CheckFactories.registerCheck<MyCheck>("module-check-name");
File: src/clang-tools-extra/clang-tidy/<module>/CMakeLists.txt
Add MyCheck.cpp to the source list.
File: src/clang-tools-extra/test/clang-tidy/checkers/<module>/check-name.cpp
// RUN: %check_clang_tidy -std=c++17-or-later %s module-check-name %t
// Mock types/classes needed for matching
void test_case() {
// Code that triggers the check
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: message
// CHECK-MESSAGES: :[[@LINE-2]]:13: note: note message
// CHECK-FIXES: expected fixed code
}
void test_negative() {
// Code that should NOT trigger the check
}
Build and run tests:
ninja check-clang-extra-clang-tidy-checkers # Run all clang-tidy tests
python3 bin/llvm-lit -v ../src/clang-tools-extra/test/clang-tidy/checkers/<module>/check-name.cpp
File: src/clang-tools-extra/docs/clang-tidy/checks/<module>/check-name.rst
.. title:: clang-tidy - module-check-name
module-check-name
=================
Brief description of what the check does.
Example
-------
.. code-block:: c++
// Before
code_before();
Transforms to:
.. code-block:: c++
// After
code_after();
File: src/clang-tools-extra/docs/clang-tidy/checks/list.rst
Add entry alphabetically:
:doc:`module-check-name <module/check-name>`, "Yes"
File: src/clang-tools-extra/docs/ReleaseNotes.rst
Under "New checks":
- New :doc:`module-check-name
<clang-tidy/checks/module/check-name>` check.
Brief description.
# Run without fixes to see diagnostics
python3 src/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
-p build \
-clang-tidy-binary build/bin/clang-tidy \
-checks='-*,module-check-name' \
'path/.*\.cpp$' 2>&1 | tee diagnostics.txt
# Apply fixes and verify build
python3 ... -fix 'path/.*\.cpp$'
ninja -C build check-<target>
check(), not in matchersassert for bound nodes - If matcher succeeded, nodes should existisMacroID() before emitting fix-itsDiagnosticIDs::Notebuild/bin/clang -Xclang -ast-dump -fsyntax-only -std=c++17 test.cpp
| Purpose | Path |
|---|---|
| Check header | src/clang-tools-extra/clang-tidy/<module>/<CheckName>Check.h |
| Check impl | src/clang-tools-extra/clang-tidy/<module>/<CheckName>Check.cpp |
| Module registration | src/clang-tools-extra/clang-tidy/<module>/<Module>TidyModule.cpp |
| CMake | src/clang-tools-extra/clang-tidy/<module>/CMakeLists.txt |
| Test | src/clang-tools-extra/test/clang-tidy/checkers/<module>/check-name.cpp |
| Documentation | src/clang-tools-extra/docs/clang-tidy/checks/<module>/check-name.rst |
| Check list | src/clang-tools-extra/docs/clang-tidy/checks/list.rst |
| Release notes | src/clang-tools-extra/docs/ReleaseNotes.rst |