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

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 4 07:23:24 PDT 2025


Author: Samarth Narang
Date: 2025-08-04T10:23:21-04:00
New Revision: ba10c1d46a221f8cf7be565cc75074ec822d5c70

URL: https://github.com/llvm/llvm-project/commit/ba10c1d46a221f8cf7be565cc75074ec822d5c70
DIFF: https://github.com/llvm/llvm-project/commit/ba10c1d46a221f8cf7be565cc75074ec822d5c70.diff

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

Addressing
https://github.com/llvm/llvm-project/pull/150003#discussion_r2249169463

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 3562c6ec68552..b5eb825eb52cc 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