[clang-tools-extra] [clang-tidy] Rename out-of-line function definitions (PR #91954)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 11:14:46 PDT 2024


================
@@ -123,6 +123,9 @@ static const NamedDecl *getFailureForNamedDecl(const NamedDecl *ND) {
   if (const auto *Method = dyn_cast<CXXMethodDecl>(ND)) {
     if (const CXXMethodDecl *Overridden = getOverrideMethod(Method))
       Canonical = cast<NamedDecl>(Overridden->getCanonicalDecl());
+    else if (const FunctionTemplateDecl *Primary = Method->getPrimaryTemplate())
+      Canonical =
+          cast<NamedDecl>(Primary->getTemplatedDecl()->getCanonicalDecl());
----------------
PiotrZSL wrote:

It's fine, but would be really nice to check if result of getTemplatedDecl isn't nullptr (just in case).

https://github.com/llvm/llvm-project/pull/91954


More information about the cfe-commits mailing list