Skip to content

Conversation

@snarang181
Copy link
Contributor

Addressing #150003 (comment)

@github-actions
Copy link

github-actions bot commented Aug 2, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@snarang181 snarang181 force-pushed the inherit-noreturn-cleanup branch from c19d6a3 to 5dbdca1 Compare August 2, 2025 12:40
@snarang181 snarang181 marked this pull request as ready for review August 2, 2025 13:21
@snarang181 snarang181 requested a review from cor3ntin August 2, 2025 13:21
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 2, 2025

@llvm/pr-subscribers-clang

Author: Samarth Narang (snarang181)

Changes

Addressing #150003 (comment)


Full diff: https://github.com/llvm/llvm-project/pull/151815.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaDecl.cpp (+4-5)
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))

@snarang181 snarang181 merged commit ba10c1d into llvm:main Aug 4, 2025
13 checks passed
@snarang181 snarang181 deleted the inherit-noreturn-cleanup branch August 4, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants