njames93 added a comment. I'd also suggest using the `IgnoreUnlessSpelledInSource` traversal kind here. Given that most of the time these will be instantiated we don't want to warn and emit a fix for each instantiation, Or you could just add `unless(isInTemplateInstantiation())` to your matcher.
================ Comment at: clang-tools-extra/clang-tidy/modernize/TypeTraitsCheck.cpp:86 + auto CurrentText = tooling::fixit::getText(*MatchedDecl, *Result.Context); + if (replacement_regex.match(CurrentText)) + IssuedDiag << FixItHint::CreateReplacement( ---------------- royjacobson wrote: > njames93 wrote: > > This fixit logic looks cumbersome, just replace the qualifier loc(::)to the > > declared with an `_v`. But only iff the qualified name loc is not a macro. > I think to do that I have to get the location of the template-id of the > qualifier from the ClassTemplateSpecializationDecl, but I haven't really > managed to do that. Or is there maybe a way to get the lexer tokens list of a > source range or something like that? Take a look here https://godbolt.org/z/Wj5bjbqGh You'd want to create an insertion of `_v` at the start of the `<` `getQualifierLoc().getTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getLAngleLoc()` Then a removal from the start of the `::` until the end of the whole expr `{getQualifierLoc().getEndLoc(), getEndLoc()}` ================ Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst:34 + same name and a ``_v`` suffix. \ No newline at end of file ---------------- Newline Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135404/new/ https://reviews.llvm.org/D135404 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits