-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang] Add __builtin_counted_by_ref builtin #114495
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
Merged
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
fe49528
[Clang] Add __builtin_counted_by_ref builtin
bwendling e3583c7
If the 'counted_by' attribute doesn't exist, then return nullptr.
bwendling 053bfcd
Remove debugging code.
bwendling 4ce6525
Make returning a nullptr the default.
bwendling 8017e73
clang-format
bwendling 8808431
Use a visitor to retrieve the MemberExpr. It's intentionally harsh an…
bwendling 122d2b8
Add testcases.
bwendling 2b58283
Combine the code to grab the MemberExpr, if it exists.
bwendling 76f01fe
Move FindCountedByField into a central place.
bwendling c95e38c
Use CustomTypeChecking for the builtin. It allows us explicitly to se…
bwendling 925fbd2
[Clang][NFC] Move FindCountedByField into FieldDecl (#104235)
bwendling ec62a2b
Fix a build failure.
bwendling d3ca48c
Remove empty line.
bwendling 85b4474
Remove merge errors.
bwendling 91a7d1b
Use 'size_t *' for the default return type and improve the testcase.
bwendling 2d95e44
Don't use a Visitor to retrieve the MemberExpr. Instead accept only n…
bwendling 9628b0f
Improve error messages. Make the side-effects error a warning.
bwendling c278c1f
Add _Generic checks.
bwendling 0f42e5d
Remove unrelated change
bwendling 751a55d
Use MemberExpr::Create instead of MemberExpr::CreateImplicit.
bwendling 53272cf
Regenerate
bwendling ecda8e0
Add -W flag for warning.
bwendling 612000f
Handle any anonymous structs surrounding the flexible array member an…
bwendling b555af9
Add anonymous struct testcase.
bwendling 48707ae
Report a fatal error if we can't find the 'count' field.
bwendling 5c778ca
Use 'cast' instead of 'dyn_cast' and default to 'void *' for the retu…
isanbard a1a6ead
A 'void *' can result in an error message about assigning to a 'void'…
bwendling 6b388b5
Add some documentation.
bwendling 791443b
Rename to __builtin_counted_by_ref.
bwendling 768e7b1
Rename method to reflect new builtin name.
bwendling 4111cc0
Emit an error if the 'count' reference is assigned to a variable, use…
bwendling d897d09
Ignore paren casts.
bwendling 4f1c313
Don't allow __builtin_counted_by_ref in complex expressions.
bwendling 7002f50
Add test case for pointers.
bwendling 7ef517b
Add SourceRange to the diagnostic.
bwendling 19e00f1
Check that __builtin_counted_by_ref isn't used on the LHS by a comple…
bwendling 8f6ef28
Update clang/include/clang/Basic/DiagnosticSemaKinds.td
bwendling cd65acc
Add a flag indicating that the 'MemberExpr' was once a call to '__bui…
bwendling 9b36f19
Remove invalid tests that take the address of the bounds counter.
bwendling c08d8d9
Add testcase that discards side-effects.
bwendling 906dd2e
Delay warnings for _Generic statements.
bwendling e3fbc03
Marking some diagnostics as 'potentially evaluated' somehow prevented…
bwendling ac5ff7c
Regenerate testcase.
bwendling 072f7e4
Fix testcase.
bwendling 391e2f6
Fix some of the naming and remove dead code.
bwendling 4555763
Correct include ordering.
bwendling 4e22bd6
Improve the argument checking so that it's checking specifically for …
bwendling 985cd02
Move setting that the counter is a bounds-safety counter to where __b…
bwendling f9ebf9f
Retain the __builtin_counted_by_ref CallExpr for AST dumping reasons.…
bwendling a5245e5
Fix
bwendling 271bb8f
Reformat
bwendling ceb43e5
Add correct attribute checking and set the return type.
bwendling b01526d
Generate LLVM IR for the __builtin_counted_by_ref.
bwendling 76aabde
Set InBounds on the GEP.
bwendling c390168
Regenerate testcase.
bwendling 213b00d
Remove warning that no longer shows up.
bwendling c4509f2
Regenerate testcase
bwendling e22f7ef
Expand testing. This includes a hack to prevent multiple diagnostics …
bwendling 90d6ea8
Add test rejecting using of 'counted_by' in C++.
bwendling 894a7da
Add -ast-print testcase.
bwendling f8de7dc
Re-add inbounds to the GEP.
bwendling ed875eb
Add test for &ptr->array
bwendling 3b50e8d
Remote -O2 from codegen.
bwendling d2112e5
Remove setting the 'inBounds' flag.
bwendling d595618
Upgrade the side-effects warning into an error.
bwendling faffcf8
Restrict __builtin_counted_by_ref to 'ptr->array' to match GCC's impl…
bwendling 426782f
Regenerate.
bwendling 4892df7
Revert the modifications as they're not affected by this feature.
bwendling e26e5b6
Add testcase.
bwendling 2a0c003
Revert.
bwendling 26d9e13
Revert unaffected tests.
bwendling 5a66155
Merge branch 'llvm:main' into builtin_get_counted_by
bwendling c37a6b3
Fix Sphinx formatting.
bwendling 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
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
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
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
Oops, something went wrong.
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.