Fix clang-tidy failures in CUDA 13.2 CI - #8251
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test b0f0a85 |
|
/ok to test fff675a |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR updates clang-tidy configuration and the clang-tidy runner script for improved compiler flag compatibility. The ChangesClang-tidy configuration and compiler flag handling
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cpp/scripts/run-clang-tidy.py`:
- Around line 184-186: The current loop using UNSUPPORTED_CLANG_FLAGS and
remove_item(command, flag) only removes exact tokens and can leave wrapper
tokens (e.g., "-Xcompiler") or inline forms ("-Xcompiler=-fno-merge-constants")
orphaned; update the filtering to remove (a) exact matches of each unsupported
flag, (b) tokens of the form "<wrapper>=<flag>" (check startswith for wrappers
like "-Xcompiler="), and (c) wrapper tokens that are separate arguments followed
by the flag (e.g., remove the "-Xcompiler" token when the next token equals the
unsupported flag). Implement this logic around the existing
UNSUPPORTED_CLANG_FLAGS and remove_item usage so command ends up free of both
standalone and wrapped forms of unsupported flags.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c9f0af32-a0fc-4346-b566-5b15fc19e021
📒 Files selected for processing (2)
cpp/.clang-tidycpp/scripts/run-clang-tidy.py
💤 Files with no reviewable changes (1)
- cpp/.clang-tidy
| for flag in UNSUPPORTED_CLANG_FLAGS: | ||
| while remove_item(command, flag) >= 0: | ||
| pass |
There was a problem hiding this comment.
Flag filtering can leave malformed compiler args.
At Line 185, removing only -fno-merge-constants by exact token can leave wrapper args like -Xcompiler orphaned (or miss inline forms like -Xcompiler=-fno-merge-constants), which can still break clang-tidy invocation.
Proposed fix
- for flag in UNSUPPORTED_CLANG_FLAGS:
- while remove_item(command, flag) >= 0:
- pass
+ i = 0
+ while i < len(command):
+ token = command[i]
+ removed = False
+ for flag in UNSUPPORTED_CLANG_FLAGS:
+ # direct token: ... -fno-merge-constants ...
+ if token == flag:
+ del command[i]
+ removed = True
+ break
+ # wrapped single token: ... -Xcompiler=-fno-merge-constants ...
+ if token == f"-Xcompiler={flag}":
+ del command[i]
+ removed = True
+ break
+ # wrapped pair: ... -Xcompiler -fno-merge-constants ...
+ if (
+ token == "-Xcompiler"
+ and i + 1 < len(command)
+ and command[i + 1] == flag
+ ):
+ del command[i : i + 2]
+ removed = True
+ break
+ if not removed:
+ i += 1🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cpp/scripts/run-clang-tidy.py` around lines 184 - 186, The current loop using
UNSUPPORTED_CLANG_FLAGS and remove_item(command, flag) only removes exact tokens
and can leave wrapper tokens (e.g., "-Xcompiler") or inline forms
("-Xcompiler=-fno-merge-constants") orphaned; update the filtering to remove (a)
exact matches of each unsupported flag, (b) tokens of the form
"<wrapper>=<flag>" (check startswith for wrappers like "-Xcompiler="), and (c)
wrapper tokens that are separate arguments followed by the flag (e.g., remove
the "-Xcompiler" token when the next token equals the unsupported flag).
Implement this logic around the existing UNSUPPORTED_CLANG_FLAGS and remove_item
usage so command ends up free of both standalone and wrapped forms of
unsupported flags.
|
/merge |
Fixes the clang-tidy PR job by:
AnalyzeTemporaryDtorskey from.clang-tidy, which clang-tidy 20 rejects.-fno-merge-constantsflag before invoking clang-tidy, since CUDA 13.2 toolchain commands can include it and clang treats it as an error underWarningsAsErrors.