Skip to content

Commit 6dfd354

Browse files
authored
[clang] ownership_returns attribute takes no more than 2 arguments (#137897)
1 parent 6e43cdb commit 6dfd354

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
14831483
break;
14841484
case OwnershipAttr::Returns:
14851485
if (AL.getNumArgs() > 2) {
1486-
S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) << AL << 1;
1486+
S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) << AL << 2;
14871487
return;
14881488
}
14891489
break;

clang/test/Sema/attr-ownership.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes
22

33
void f1(void) __attribute__((ownership_takes("foo"))); // expected-error {{'ownership_takes' attribute requires parameter 1 to be an identifier}}
4-
void *f2(void) __attribute__((ownership_returns(foo, 1, 2))); // expected-error {{'ownership_returns' attribute takes no more than 1 argument}}
4+
void *f2(void) __attribute__((ownership_returns(foo, 1, 2))); // expected-error {{'ownership_returns' attribute takes no more than 2 arguments}}
55
void f3(void) __attribute__((ownership_holds(foo, 1))); // expected-error {{'ownership_holds' attribute parameter 1 is out of bounds}}
66
void *f4(void) __attribute__((ownership_returns(foo)));
77
void f5(void) __attribute__((ownership_holds(foo))); // expected-error {{'ownership_holds' attribute takes at least 2 arguments}}

0 commit comments

Comments
 (0)