Hi,
As my first contribution to LLVM I would like to implement a clang-tidy check that enforces the usage of scoped enumerations based on the C++ Core Guidelines. I already submitted a review and now I am working on the changes based on the feedback.
I think I addressed most of the feedback, but I have some difficulties to figure out when an unscoped enum cannot be changed to scoped enumerations. A good example for this is already mentioned in the review: when any of the decls or the usages (except the ones that are properly qualified by the enum name) are in a macro.
I think another example for the unfixable case might be if any of the decls or the usages are in a source from where the diagnostics are emitted, i.e.: filtered out with header-filter or line-filter arguments. Can I somehow extract that information within a derived class of ClangTidyCheck? I think the ClangTidiyCheck::Context member variable holds that information, but it doesn’t expose that member nor the necessary information to the derived classes.
To sum up, my questions are:
-
Can I somehow check from a derived ClangTidyCheck if the current location is going to be filtered out?
-
If the answer for the previous question is no, then how should I handle this situation?
-
Do you know any other case where the decls/usages shouldn’t be fixed?
Thanks for the help,
Benjamin