[clang] [clang][NFC] Code Cleanup of inferred noreturn attributes in explicit specializations. (PR #151815)

Samarth Narang via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 2 05:40:42 PDT 2025


https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/151815

>From 5dbdca199d6c6d9b150bdb3bb447fab9e313962d Mon Sep 17 00:00:00 2001
From: Samarth Narang <snarang at umass.edu>
Date: Sat, 2 Aug 2025 08:37:06 -0400
Subject: [PATCH] Cleanup of inferred noreturn attributes in explicit
 specializations.

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

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 20fdf2de59cb1..e56799deafa5c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3269,11 +3269,10 @@ void Sema::mergeDeclAttributes(NamedDecl *New, Decl *Old,
       continue;
 
     if (isa<InferredNoReturnAttr>(I)) {
-      if (auto *FD = dyn_cast<FunctionDecl>(New)) {
-        if (FD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
-          continue; // Don't propagate inferred noreturn attributes to explicit
-                    // specializations.
-      }
+      if (auto *FD = dyn_cast<FunctionDecl>(New);
+          FD &&
+          FD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
+        continue; // Don't propagate inferred noreturn attributes to explicit
     }
 
     if (mergeDeclAttribute(*this, New, I, LocalAMK))



More information about the cfe-commits mailing list