Repository navigation
clang-tidy as part of the actual build #3272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mdboom
wants to merge
8
commits into
NVIDIA:main
Choose a base branch
from
mdboom:clang-tidy2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
30f1ad1
clang-tidy as part of the actual build
mdboom 8ad4030
Address comments in the review, and make clang-tidy work in the pixi …
mdboom d315dce
Fix small formatting nit
mdboom 8a90fda
Further bugfixes
mdboom 021937f
More bugfixes
mdboom c4bc359
Display all errors before quitting
mdboom 87fb95a
Fix Windows clang-tidy issue
mdboom 03c6b31
Remove slop comment
mdboom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Layout is clang-format's job (see .clang-format), so clang-tidy does no | ||
| # formatting of its own (FormatStyle: none below). Each enabled check is meant | ||
| # to be adoptable on its own, so findings can be fixed one check at a time. | ||
| # | ||
| # Checks are opt-in (-*) by group, minus the ones below. They cannot be | ||
| # commented inline because Checks is a single YAML string. | ||
| # | ||
| # Disabled because they conflict with the C-style CUDA driver API idioms: | ||
| # bugprone-easily-swappable-parameters: wrappers of driver calls take many | ||
| # adjacent parameters of the same type; the signatures mirror the API. | ||
| # bugprone-assignment-in-if-condition: `if (CUDA_SUCCESS != (err = CALL(...)))` | ||
| # is the standard error-handling pattern here. | ||
| # performance-no-int-to-ptr: opaque handles and file descriptors are | ||
| # converted to pointers with reinterpret_cast on purpose. | ||
| # modernize-avoid-c-arrays: arrays are passed to and filled by C APIs. | ||
| # modernize-return-braced-init-list: `return {};` vs. an explicit type is | ||
| # left to the author; it adds noise for the driver-API result structs. | ||
| # bugprone-throwing-static-initialization: the handle registries are | ||
| # process-lifetime globals whose constructors allocate on some standard | ||
| # libraries (MSVC); running out of memory while loading the module is | ||
| # fatal either way. | ||
| # | ||
| # Disabled because they do not match the codebase style: | ||
| # performance-enum-size: enum underlying types are left as they are. | ||
| # misc-const-correctness: const on every local is not the convention here. | ||
| # readability-function-cognitive-complexity: too disruptive. | ||
| # readability-identifier-length: short names such as the handle parameter `h` | ||
| # are used throughout. | ||
| # readability-implicit-bool-conversion: `if (ptr)` and `if (handle)` are the | ||
| # idiom for pointers and handles. | ||
| # misc-include-cleaner: too noisy with the CUDA and CPython umbrella headers. | ||
| # misc-no-recursion: recursion is used deliberately. | ||
| # misc-use-anonymous-namespace: file-local functions use `static`. | ||
| # modernize-use-trailing-return-type: the code uses `Type\nname()` layout. | ||
| Checks: > | ||
| -*, | ||
| bugprone-*, | ||
| -bugprone-easily-swappable-parameters, | ||
| -bugprone-assignment-in-if-condition, | ||
| -bugprone-throwing-static-initialization, | ||
| clang-analyzer-*, | ||
| misc-*, | ||
| -misc-include-cleaner, | ||
| -misc-const-correctness, | ||
| -misc-no-recursion, | ||
| -misc-use-anonymous-namespace, | ||
| modernize-*, | ||
| -modernize-use-trailing-return-type, | ||
| -modernize-avoid-c-arrays, | ||
| -modernize-return-braced-init-list, | ||
| performance-*, | ||
| -performance-enum-size, | ||
| -performance-no-int-to-ptr, | ||
| readability-*, | ||
| -readability-function-cognitive-complexity, | ||
| -readability-identifier-length, | ||
| -readability-implicit-bool-conversion | ||
| FormatStyle: none | ||
| CheckOptions: | ||
| # Records whose members are all public (the *Box and guard structs) are plain | ||
| # data holders; only a mix of public and private members is flagged. | ||
| misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: true | ||
| WarningsAsErrors: '*' | ||
| # Only report diagnostics for our own headers, not CUDA/CPython/libstdc++. | ||
| HeaderFilterRegex: 'cuda[/\\]core[/\\]_(cpp|include)[/\\]' | ||
| ExcludeHeaderFilterRegex: 'cuda[/\\]core[/\\]_include[/\\](dlpack|aoti_shim)\.h' |
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having 'static' or removing it has not effected on the generated binary. However I would like the source code to consistently include
staticor consistently not include them. Is there a clang-tidy rule or equivalent that we can enable to ensure that is the case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason the
staticis removed here is because it's inside an anonymous namespace (where everything always has internal linkage so thatstaticis redundant). This is enforced by thereadability-static-definition-in-anonymous-namespace. We could exclude that rule, which would makestaticallowed here, but wouldn't enforce that it is always there. My agent (and I) think that no such rule exists.Outside of anonymous namespaces,
statichas actual semantic meaning and just needs to be applied correctly, but it wouldn't make sense to always have it or not have it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's basically what I was saying. I don't really care if
staticis always there or always not there -- as long as we are consistently applying that across the code base.