Skip to content

Commit 8bd3f8d

Browse files
committed
change warning
1 parent ffba96a commit 8bd3f8d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

clang/lib/Sema/SemaType.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8614,8 +8614,9 @@ static void HandleLifetimeBoundAttr(TypeProcessingState &State,
86148614
CurType, CurType);
86158615
return;
86168616
}
8617-
State.getSema().Diag(Attr.getLoc(), diag::err_attribute_not_type_attr)
8618-
<< Attr << Attr.isRegularKeywordAttribute();
8617+
State.getSema().Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str)
8618+
<< Attr << Attr.isRegularKeywordAttribute()
8619+
<< "parameters and implicit object parameters";
86198620
}
86208621

86218622
static void HandleLifetimeCaptureByAttr(TypeProcessingState &State,

clang/test/SemaCXX/attr-lifetimebound.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ namespace usage_invalid {
1111
int *explicit_object(this A&) [[clang::lifetimebound]]; // expected-error {{explicit object member function has no implicit object parameter}}
1212
int attr_on_var [[clang::lifetimebound]]; // expected-error {{only applies to parameters and implicit object parameters}}
1313
int [[clang::lifetimebound]] attr_on_int; // expected-error {{cannot be applied to types}}
14-
int * [[clang::lifetimebound]] attr_on_int_ptr; // expected-error {{cannot be applied to types}}
15-
int * [[clang::lifetimebound]] * attr_on_int_ptr_ptr; // expected-error {{cannot be applied to types}}
16-
int (* [[clang::lifetimebound]] attr_on_func_ptr)(); // expected-error {{cannot be applied to types}}
14+
int * [[clang::lifetimebound]] attr_on_int_ptr; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}}
15+
int * [[clang::lifetimebound]] * attr_on_int_ptr_ptr; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}}
16+
int (* [[clang::lifetimebound]] attr_on_func_ptr)(); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}}
1717
void void_return_member() [[clang::lifetimebound]]; // expected-error {{'lifetimebound' attribute cannot be applied to an implicit object parameter of a function that returns void; did you mean 'lifetime_capture_by(X)'}}
1818
};
1919
int *attr_with_param(int &param [[clang::lifetimebound(42)]]); // expected-error {{takes no arguments}}
2020

21-
void attr_on_ptr_arg(int * [[clang::lifetimebound]] ptr); // expected-error {{cannot be applied to types}}
21+
void attr_on_ptr_arg(int * [[clang::lifetimebound]] ptr); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}}
2222
static_assert((int [[clang::lifetimebound]]) 12); // expected-error {{cannot be applied to types}}
23-
int* attr_on_unnamed_arg(const int& [[clang::lifetimebound]]); // expected-error {{cannot be applied to types}}
23+
int* attr_on_unnamed_arg(const int& [[clang::lifetimebound]]); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}}
2424
template <typename T>
25-
int* attr_on_template_ptr_arg(T * [[clang::lifetimebound]] ptr); // expected-error {{cannot be applied to types}}
25+
int* attr_on_template_ptr_arg(T * [[clang::lifetimebound]] ptr); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}}
2626
}
2727

2828
namespace usage_ok {

0 commit comments

Comments
 (0)