Skip to content

Commit 2b285ec

Browse files
committed
#GH134465 Modified version
1 parent 28acee4 commit 2b285ec

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Improvements to Clang's diagnostics
325325
- Now correctly diagnose a tentative definition of an array with static
326326
storage duration in pedantic mode in C. (#GH50661)
327327

328-
- The ``-err-musttail-mismatch`` error is emitted when a musttail call is made to a function marked with the not_tail_called attribute.(#133509).
328+
- An error is now emitted when a ``musttail`` call is made to a function marked with the ``not_tail_called`` attribute. (#GH133509).
329329

330330

331331
Improvements to Clang's time-trace

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,7 +3134,6 @@ def warn_function_attribute_ignored_in_stmt : Warning<
31343134
"use '%0' on statements">,
31353135
InGroup<IgnoredAttributes>;
31363136

3137-
31383137
def err_musttail_needs_trivial_args : Error<
31393138
"tail call requires that the return value, all parameters, and any "
31403139
"temporaries created by the expression are trivially destructible">;
@@ -3162,7 +3161,7 @@ def err_musttail_member_mismatch : Error<
31623161
def note_musttail_callee_defined_here : Note<"%0 declared here">;
31633162
def note_tail_call_required : Note<"tail call required by %0 attribute here">;
31643163
def err_musttail_mismatch : Error<
3165-
"cannot perform a tail call to function%select{| %1}0 because its signature "
3164+
"cannot perform a tail call to function %select{| %1}0 because its signature "
31663165
"is incompatible with the calling function">;
31673166
def note_musttail_mismatch : Note<
31683167
"target function "

clang/lib/Sema/SemaStmt.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,9 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) {
718718
}
719719

720720
if (const FunctionDecl *CalleeDecl = CE->getDirectCallee();
721-
CalleeDecl && CalleeDecl->hasAttr<NotTailCalledAttr>()) {
722-
Diag(St->getBeginLoc(), diag::err_musttail_mismatch)
723-
<< &MTA;
724-
return false;
721+
CalleeDecl && CalleeDecl->hasAttr<NotTailCalledAttr>()) {
722+
Diag(St->getBeginLoc(), diag::err_musttail_mismatch) << &MTA;
723+
return false;
725724
}
726725

727726
if (const auto *EWC = dyn_cast<ExprWithCleanups>(E)) {

clang/test/Sema/attr-musttail.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ int __attribute__((not_tail_called)) foo1(int a) {
77

88
int foo2(int a) {
99
[[clang::musttail]]
10-
return foo1(a); // expected-error{{cannot perform a tail call to function'musttail' because its signature is incompatible with the calling function}}
10+
return foo1(a); // expected-error{{cannot perform a tail call to function 'musttail' because its signature is incompatible with the calling function}}
1111
}
1212

1313
int main() {
1414
int result = foo2(10);
1515
return 0;
16-
}
16+
}
17+

0 commit comments

Comments
 (0)