[clang] [Clang][Sema]:Fix musttail attribute on a function with not_tail_called attribute has no warning/error (PR #134465)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 14 10:43:26 PDT 2025
================
@@ -717,6 +717,13 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) {
return false;
}
+ if (const FunctionDecl *CalleeDecl = CE->getDirectCallee();
+ CalleeDecl && CalleeDecl->hasAttr<NotTailCalledAttr>()) {
+ Diag(St->getBeginLoc(), diag::err_musttail_mismatch) << /*show-function-callee=*/true << CalleeDecl;
+ Diag(CalleeDecl->getLocation(), diag::note_musttail_disabled_by_not_tail_called) << CalleeDecl;
----------------
AaronBallman wrote:
I don't feel strongly about reusing the existing diagnostic, this new note is fine by me.
https://github.com/llvm/llvm-project/pull/134465
More information about the cfe-commits
mailing list