================
@@ -6101,7 +6101,17 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId 
&Name) {
   }
 
   case UnqualifiedIdKind::IK_TemplateId: {
+    if (!Name.TemplateId)
+      return DeclarationNameInfo();
+
+    if (Name.TemplateId->isInvalid())
+      return DeclarationNameInfo();
+
     TemplateName TName = Name.TemplateId->Template.get();
+
+    if (TName.isNull())
+      return DeclarationNameInfo();
----------------
nehaGautam07 wrote:

Thanks for the suggestion.

After re-verifying, getNameForTemplate() can be invoked with an invalid 
template-id, leading to a crash. Guarding on Name.TemplateId->isInvalid() 
prevents this while keeping the change minimal.

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

Reply via email to