[clang] [Clang][Sema]:Fix musttail attribute on a function with not_tail_called attribute has no warning/error (PR #134465)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 14 07:12:58 PDT 2025
================
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+int __attribute__((not_tail_called)) foo1(int a) {
+ return a + 1;
+}
+
+
+int foo2(int a) {
+ [[clang::musttail]]
+ return foo1(a); // expected-error {{cannot perform a tail call to function 'foo1' because its signature is incompatible with the calling function}}
----------------
erichkeane wrote:
In `SemaStmt.cpp` right after the line:
`Diag(St->getBeginLoc(), diag::err_musttail_mismatch) << true << CalleeDecl;`
You can do:
`Diag(<get location of not_tail_called_attribute>, diag::note_<your new diag>);`
https://github.com/llvm/llvm-project/pull/134465
More information about the cfe-commits
mailing list