https://github.com/MillePlateaux created 
https://github.com/llvm/llvm-project/pull/134465

Added judgment statements and accurately reported errors.Closes #133509

>From c7bd0c4413cbf4768105be178341ff169e460617 Mon Sep 17 00:00:00 2001
From: MillePlateaux <liulam...@outlook.com>
Date: Fri, 4 Apr 2025 16:26:25 -0700
Subject: [PATCH] [llvm][Stmt]:git clang format

---
 clang/lib/Sema/SemaStmt.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index e1b9ccc693bd5..c8354198a5614 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -717,6 +717,14 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr 
&MTA) {
     return false;
   }
 
+  if (const FunctionDecl *CalleeDecl = CE->getDirectCallee()) {
+    if (CalleeDecl->hasAttr<NotTailCalledAttr>()) {
+      Diag(St->getBeginLoc(), 
diag::err_musttail_conflicts_with_not_tail_called)
+          << &MTA;
+      return false;
+    }
+  }
+
   if (const auto *EWC = dyn_cast<ExprWithCleanups>(E)) {
     if (EWC->cleanupsHaveSideEffects()) {
       Diag(St->getBeginLoc(), diag::err_musttail_needs_trivial_args) << &MTA;

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to