| Issue |
238069
|
| Summary |
[clang-tidy] Feature request: `misc-type-trait-simplification`
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
Jacobfaib
|
Diagnose redundant or unnecessary combinations of type traits. `modernize-type-traits` already does this to a limited extent, suggesting `remove_cv_t<remove_reference_t<T>>` -> `remove_cvref_t<T>`. There are many other cases where the same idea applies, for example:
- `add_const_t<add_volatile_t<T>>` -> `add_cv_t<T>`
- `decay_t<remove_reference_t<T>>` -> `decay_t<T>`
We have a [reference implementation](https://github.com/NVIDIA/cccl/blob/main/cmake/clang_tidy_plugins/simplify_type_traits/simplify_type_traits.cpp) in libcudacxx (which is heavily adapted from libcxx ;)). Since we found many hits in our own codebase, we reckon a check like this would also be useful for the wider C++ community.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs