-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[AArch64][SME] Add diagnostics for SME attributes on lambda functions #121777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
00772b8
bbc80c2
02658f7
d47933c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -fsyntax-only -verify %s | ||
| // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -std=c++23 -fsyntax-only -verify %s | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about this change requires c++23?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think adding attributes to lambdas before the parameter list was only allowed in C++23. If I don't pass this flag, the error emitted is instead |
||
|
|
||
| // This test is testing the diagnostics that Clang emits when compiling without '+sme'. | ||
|
|
||
|
|
@@ -48,3 +48,9 @@ void streaming_compatible_def2(void (*streaming_fn_ptr)(void) __arm_streaming, | |
| // Also test when call-site is not a function. | ||
| int streaming_decl_ret_int() __arm_streaming; | ||
| int x = streaming_decl_ret_int(); // expected-error {{call to a streaming function requires 'sme'}} | ||
|
|
||
| void sme_attrs_lambdas() { | ||
| [] __arm_locally_streaming () { return; }(); // expected-error {{function executed in streaming-SVE mode requires 'sme'}} | ||
| [] __arm_new("za") () { return; }(); // expected-error {{function using ZA state requires 'sme'}} | ||
| [] __arm_new("zt0") () { return; }(); // expected-error {{function using ZT0 state requires 'sme2'}} | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a
staticmember function instead? (would have to take theASTContextas parameter)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed this to
staticand addedSemaas a parameter, so that the function can still useDiag()for emitting the diagnostics.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit inconsistent with everything else, the intent is to use
ARM().CheckSMEFunctionDefAttributes(FD)(The reason we did that was to split Sema into multiple classes/files)
@Endilll
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like an ARM-specific function, so you correctly placed it in
SemaARM, and it's referenced in SemaDecl and SemaDeclCXX, so it can't be static. Corentin is correct thatARM().CheckSMEFunctionDefAttributes(FD)is the way to use it from outside of SemaARM.The current state of the changes seems correct to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback, I didn't realise that there was already precedent for using
ARM().Check...