================ @@ -181,42 +160,105 @@ void ConfusableIdentifierCheck::check( if (!ND) return; - IdentifierInfo *NDII = ND->getIdentifier(); + addDeclToCheck(ND, cast<Decl>(ND->getDeclContext() + ->getNonTransparentContext())); + + // Associate template parameters with this declaration of this template. + if (const auto *TD = dyn_cast<TemplateDecl>(ND)) { + for (const NamedDecl *Param : *TD->getTemplateParameters()) + addDeclToCheck(Param, TD->getTemplatedDecl()); + } + + // Associate function parameters with this declaration of this function. + if (const auto *FD = dyn_cast<FunctionDecl>(ND)) { + for (const NamedDecl *Param : FD->parameters()) + addDeclToCheck(Param, ND); + } +} + +void ConfusableIdentifierCheck::addDeclToCheck(const NamedDecl *ND, ---------------- 5chmidti wrote:
Thinking about clangd and incomplete code, I think this is the only part in your changes I would suggest adding additional `nullptr` handling (for `ND` and `Parent`), just to be on the safe side. https://github.com/llvm/llvm-project/pull/130369 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits