Following on from review comments in D65919 about the ordering
of the registerCheck<> calls. Sort the calls based on the check name
string
Details
- Reviewers
aaron.ballman alexfh djasper JonasToth - Commits
- rG0cdb04c3cfe0: Make add_new_check.py's insertion of registerCheck<> match the sort order
rCTE370527: Make add_new_check.py's insertion of registerCheck<> match the sort order
rL370527: Make add_new_check.py's insertion of registerCheck<> match the sort order
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 37581 Build 37580: arc lint + arc unit
Event Timeline
Given that the alphabetization we want really is based on the string literal, would it make sense to look for that rather than the check name? Adding a few more reviewers for a better mix of opinions.
Ideally, it would be nice to sort the list of registrations by the check name. But given that the call can span two lines, that may be slightly trickier to implement. It's worth giving it a try though ;)
Mostly LG, if you've verified that this works. A couple of comments below.
clang-tools-extra/clang-tidy/add_new_check.py | ||
---|---|---|
192 | Are there actually any registerCheck calls with spaces between the > and the (? Should we clang-format these instead of supporting them in the script? | |
193 | I'd call this previous_line or prev_line. "Last" is a bit misleading here. |
Generally LG to me as well
clang-tools-extra/clang-tidy/add_new_check.py | ||
---|---|---|
198 | Missing a full stop at the end of the comment. |
I verified it using
./add_new_check.py llvm prefer-register-over-unsigned ./add_new_check.py llvm zzz ./add_new_check.py llvm nb ./add_new_check.py llvm iz ./add_new_check.py llvm a
which is enough to cover every insertion point in the LLVM module
clang-tools-extra/clang-tidy/add_new_check.py | ||
---|---|---|
192 |
No, it was just trivial to be robust against it in case it does somehow happen. Likewise for the whitespace after the '(' but before the '"' or newline.
I think the script should stick to inserting the new code rather than correcting existing mistakes that somehow crept in. I do agree that people should generally clang-format their patches before commit though which will prevent it creeping in. |
Missed one of the commands from my history that I used to verify it:
./add_new_check.py llvm i
Are there actually any registerCheck calls with spaces between the > and the (? Should we clang-format these instead of supporting them in the script?