[clang-tools-extra] [clang-tidy] Extend `modernize-type-traits` to fold remove_cv_t<remove_reference_t<...>> into remove_cv_ref_t (PR #204789)
Zeyi Xu via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 20 00:31:59 PDT 2026
================
@@ -308,6 +322,20 @@ void TypeTraitsCheck::check(const MatchFinder::MatchResult &Result) {
DNTL->getElaboratedKeywordLoc());
return;
}
+
+ if (const auto *TSTL = Result.Nodes.getNodeAs<TemplateSpecializationTypeLoc>(
+ "remove_cvref")) {
+ auto Diag = diag(TSTL->getBeginLoc(), "use c++20 type alias");
----------------
zeyi2 wrote:
IMO we might better check `IgnoreMacros` here.
```cpp
#define CVREF(T) std::remove_cv_t<std::remove_reference_t<T>>
using X = CVREF(int);
```
With `IgnoreMacros: true`, the new `remove_cvref` matcher currently still diagnoses this case.
Could you add a macro location guard to it?
https://github.com/llvm/llvm-project/pull/204789
More information about the cfe-commits
mailing list