-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Clang][Sema] Add __builtin_infer_alloc_token() declaration and semantic checks #163638
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
Merged
melver
merged 15 commits into
main
from
users/melver/spr/clangsema-add-__builtin_infer_alloc_token-declaration-and-semantic-checks
Oct 23, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
052ff02
[𝘀𝗽𝗿] changes to main this commit is based on
melver 2c55408
[𝘀𝗽𝗿] initial version
melver 99e17cc
[𝘀𝗽𝗿] changes introduced through rebase
melver a465aa7
fixup! address comments
melver 990d7c0
[𝘀𝗽𝗿] changes introduced through rebase
melver a065244
address comments and rebase
melver 9437129
[𝘀𝗽𝗿] changes introduced through rebase
melver ed7cc16
rebase
melver d00d81f
[𝘀𝗽𝗿] changes introduced through rebase
melver 28a5a5b
rebase
melver ef1717d
[𝘀𝗽𝗿] changes introduced through rebase
melver f88af95
rebase
melver 02eda67
[𝘀𝗽𝗿] changes introduced through rebase
melver 66b3bc7
rebase
melver 83321df
rebase
melver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s | ||
| // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter | ||
| // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -falloc-token-mode=typehash -DMODE_TYPEHASH | ||
|
|
||
| #if !__has_builtin(__builtin_infer_alloc_token) | ||
| #error "missing __builtin_infer_alloc_token" | ||
| #endif | ||
|
|
||
| template <typename T = void> | ||
| void template_test() { | ||
| __builtin_infer_alloc_token(T()); // no error if not instantiated | ||
| } | ||
|
|
||
| template <typename T> | ||
| void negative_template_test() { | ||
| __builtin_infer_alloc_token(T()); // expected-error {{argument may not have 'void' type}} | ||
| } | ||
|
|
||
| void negative_tests() { | ||
| __builtin_infer_alloc_token(); // expected-error {{too few arguments to function call}} | ||
| __builtin_infer_alloc_token((void)0); // expected-error {{argument may not have 'void' type}} | ||
| negative_template_test<void>(); // expected-note {{in instantiation of function template specialization 'negative_template_test<void>' requested here}} | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.