-
Notifications
You must be signed in to change notification settings - Fork 5
Add translation rules for variadic libc calls #159
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
Open
lucic71
wants to merge
29
commits into
Cpp2Rust:master
Choose a base branch
from
lucic71:variadic-call
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
cf96ccd
Refactor ConvertGenericCallExpr
lucic71 1c0fb3a
EmitArgBindings -> EmitHoistedArgs
lucic71 e98df0c
Drop default initialization fom CallInfo
lucic71 01765d8
Add prefix on param_name from construction
lucic71 dba4b3b
Pass CallInfo by rvalue reference
lucic71 5c1425d
Reorder CallArg fields by size
lucic71 06097f8
Reorder initialization
lucic71 27fd2af
Reorder CallInfo fields
lucic71 768b308
Use template syntax to declare rules for variadic functions
lucic71 60fc170
Add src rules for variadic functions
lucic71 08d2cc1
Add Rust rule counterpart
lucic71 c85429d
Add C rules for builtin mul overflow
lucic71 d2ac848
Read the is_variadic attribute on the other side
lucic71 8b98f29
Save CallExpr instead of callee in CallInfo
lucic71 91b69ea
Set is_libc_passthrough
lucic71 ba997cd
Use correct types for arguments
lucic71 108cdb7
Use declared type for each argument in passthrough mode
lucic71 f000eb5
Fix code
lucic71 70f5880
Missing part of c85429df5caa6474c2a9f1f9f2f5afc632e38ef0
lucic71 3bc0b4c
Fix is_libc_passthrough condition
lucic71 b4219d8
Merge branch 'master' into variadic-call
lucic71 c68dcee
Re-add paren for variadic arg
lucic71 680424e
Fix merge artifacts
lucic71 0c3a442
Add Mapper::IsLibcPassthrough
lucic71 582d5d3
Replace is_variadic with is_extern
lucic71 eb19e52
Add var args tests
lucic71 1736ec5
Delete non-portable test code parts
lucic71 042eac9
Merge branch 'master' into variadic-call
lucic71 addc4cd
Clang-format
lucic71 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
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,2 @@ | ||
| int f12(long a, long b, long *r) { return __builtin_mul_overflow(a, b, r); } | ||
| int f13(long long a, long long b, long long *r) { return __builtin_mul_overflow(a, b, r); } |
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,14 @@ | ||
| // Copyright (c) 2022-present INESC-ID. | ||
| // Distributed under the MIT license that can be found in the LICENSE file. | ||
|
|
||
| #include <fcntl.h> | ||
|
|
||
| template <typename... Args> | ||
| int f1(int a0, int a1, Args... args) { | ||
| return fcntl(a0, a1, args...); | ||
| } | ||
|
|
||
| template <typename... Args> | ||
| int f2(const char *a0, int a1, Args... args) { | ||
| return open(a0, a1, args...); | ||
| } |
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,7 @@ | ||
| // Copyright (c) 2022-present INESC-ID. | ||
| // Distributed under the MIT license that can be found in the LICENSE file. | ||
|
|
||
| unsafe extern "C" { | ||
| fn f1(a0: i32, a1: i32, ...) -> i32; | ||
| fn f2(a0: *const i8, a1: i32, ...) -> i32; | ||
| } |
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,9 @@ | ||
| // Copyright (c) 2022-present INESC-ID. | ||
| // Distributed under the MIT license that can be found in the LICENSE file. | ||
|
|
||
| #include <sys/ioctl.h> | ||
|
|
||
| template <typename... Args> | ||
| int f1(int a0, unsigned long a1, Args... args) { | ||
| return ioctl(a0, a1, args...); | ||
| } |
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,6 @@ | ||
| // Copyright (c) 2022-present INESC-ID. | ||
| // Distributed under the MIT license that can be found in the LICENSE file. | ||
|
|
||
| unsafe extern "C" { | ||
| fn f1(a0: i32, a1: u64, ...) -> i32; | ||
| } |
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.
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.
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 think that this can be replaced by
clang::TemplateArgument::getEmptyPack()