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

>From 28cd7775fba49e938db8f79d1ce8c55adbeebccb Mon Sep 17 00:00:00 2001
From: Soham Karandikar <[email protected]>
Date: Sun, 19 Jul 2026 21:55:54 +0530
Subject: [PATCH 1/2] Added a check for `NameInfo` actually containing a valid
 destructor name

---
 clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index c2e90624b8a6e..30ddad02f63c2 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3287,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;
+      }
+      Method = CXXDestructorDecl::Create(
         SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo,
         Destructor->UsesFPIntrin(), Destructor->isInlineSpecified(), false,
         Destructor->getConstexprKind(), TrailingRequiresClause);

>From 7bb6ae3f23d571d3a20e9966568c6890ed0f0563 Mon Sep 17 00:00:00 2001
From: Soham Karandikar <[email protected]>
Date: Mon, 20 Jul 2026 00:48:41 +0530
Subject: [PATCH 2/2] Simplified if-statement, ran clang-format

---
 clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 30ddad02f63c2..df559711f1674 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3287,10 +3287,11 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(
         TrailingRequiresClause);
     Method->setRangeEnd(Constructor->getEndLoc());
   } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
-      if (NameInfo.getName().getNameKind() != 
DeclarationName::NameKind::CXXDestructorName) {
-          return nullptr;
-      }
-      Method = CXXDestructorDecl::Create(
+    if (NameInfo.getName().getNameKind() !=
+        DeclarationName::NameKind::CXXDestructorName)
+      return nullptr;
+
+    Method = CXXDestructorDecl::Create(
         SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo,
         Destructor->UsesFPIntrin(), Destructor->isInlineSpecified(), false,
         Destructor->getConstexprKind(), TrailingRequiresClause);

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to