Issue 202346
Summary [clang-tidy] Make `modernize-avoid-c-arrays` have an optional fix
Labels clang-tidy
Assignees
Reporter void2012
    Currently, the clang-tidy documentation states that `modernize-avoid-c-arrays` is ["dangerous to use"](https://clang.llvm.org/extra/clang-tidy/checks/modernize/avoid-c-arrays.html#modernize-avoid-c-arrays):

`fix-it are potentially dangerous in header files and are therefore not emitted right now.`

However, since this feature would be very useful by itself (imagine the amount of boilerplate C++98 style code using c-style arrays, especially for complex types and non-integer literal constant, it gets way harder to refactor this without making mistakes, or create a python script catching all cases, so the most reliable solution is compiler-supported automatic generation of equivalent std::array via clang-tidy), and I would like to utilize it maybe via copying the clang-tidy generated type everywhere else (currently, I understand that checking everything in header files would be very hard to implement for clang-tidy developers, but since there is no good solution for now, something automatically generated which I can then copy-paste would be much better than what we have now).

I propose adding a clang-tidy configuration flag that would allow this option to propose a fix (which is especially useful with IDEs in combination with clangd and clang-tidy)
Thanks.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to