[clang] [Clang] [Sema] Added a check for `NameInfo` actually containing a valid destructor name (PR #210610)

Hardik Kumar via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 19 12:02:31 PDT 2026


================
@@ -3286,7 +3287,10 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(
         TrailingRequiresClause);
     Method->setRangeEnd(Constructor->getEndLoc());
   } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
-    Method = CXXDestructorDecl::Create(
+      if (NameInfo.getName().getNameKind() != DeclarationName::NameKind::CXXDestructorName) {
+          return nullptr;
+      }
----------------
hardikxk wrote:

```cpp
if (NameInfo.getName().getNameKind() != DeclarationName::NameKind::CXXDestructorName)
    return nullptr;
```

Can be simplified to this 

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


More information about the cfe-commits mailing list