Open arijun opened 1 year ago
@llvm/issue-subscribers-clang-tidy
I think it would make sense to limit the diagnostic range to the typedef
keyword for all modernize-use-using
diagnostics (not just ones for enums).
This isn't a highlight, that is a "fix":
1.cpp:1:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
1 | typedef enum {A, B, C} myEnum;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| using myEnum = enum {A, B, C}
When someone defines a C-style enum with
typdef enum {...} name
, the entirety of the enum (from typedef to name) is highlighted bymodernize-use-using
. This can be a bit jarring in longer enums where there can be hundreds of lines of enum entries marked with a warning. It also doesn't seem to be in line with the rest of themodernize-
lints; inmodernize-avoid-c-arrays
,int arr[3]
would only highlight theint
and not everything through the[3]
, andmodernize-loop-convert
similarly only highlights thefor
.This issue is made worse in the VS Code clangd extension, where
modernize-
lints are marked as deprecated, and are struck-through in addition to being highlighted--greatly reducing readability of the enum entries. For example