Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e01ea6c

Browse files
authored
[clang-tidy] Reject malformed -std spellings in check_clang_tidy.py. NFC. (#195609)
`check_clang_tidy.py` expanded any `-std` value containing `-or-later`, even when extra text followed the suffix. e.g. `c++20-or-latermisc` was treated like `c++20-or-later`. This commit requires `-or-later` to be the actual end of the spelling before expanding it, so malformed values are passed through and diagnosed by clang.
1 parent 74cadb8 commit e01ea6c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,11 @@ def run(self) -> None:
460460

461461

462462
def expand_std(std: str) -> List[str]:
463-
split_std, or_later, _ = std.partition("-or-later")
463+
split_std, or_later, suffix = std.partition("-or-later")
464+
465+
if or_later and suffix:
466+
# Keep malformed -or-later spellings unchanged so clang diagnoses them.
467+
return [std]
464468

465469
if not or_later:
466470
return [split_std]

0 commit comments

Comments
 (0)