Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for stubbing out foreign functions #2658

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

feliperodri
Copy link
Contributor

@feliperodri feliperodri commented Aug 3, 2023

Description of changes:

Support for stubbing out foreign functions.

Resolved issues:

Resolves #2587.

Call-outs:

N/A.

Testing:

  • How is this change tested? Regression tests.

  • Is this a refactor change? No.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@feliperodri feliperodri self-assigned this Aug 3, 2023
@feliperodri feliperodri force-pushed the extern-c-stubbing branch 2 times, most recently from 077ef36 to fbc7abd Compare August 3, 2023 20:24
@feliperodri feliperodri marked this pull request as ready for review August 3, 2023 22:01
@feliperodri feliperodri requested a review from a team as a code owner August 3, 2023 22:01
Copy link
Contributor

@JustusAdam JustusAdam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a test case for the use of function pointers ad make sure it is handled, irrespective of whether we want to allow use of function pointers or not.

@feliperodri feliperodri changed the title Support for stubbing out extern functions Support for stubbing out foreign functions Aug 4, 2023
@feliperodri feliperodri disabled auto-merge August 8, 2023 17:40
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
@feliperodri feliperodri requested a review from celinval August 8, 2023 18:22
@feliperodri feliperodri enabled auto-merge (squash) August 8, 2023 18:23
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
@feliperodri feliperodri merged commit 6a151f9 into model-checking:main Aug 8, 2023
@feliperodri feliperodri deleted the extern-c-stubbing branch August 8, 2023 19:24
pub fn transform_foreign_functions<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
if let Some(stub_map) = get_stub_mapping(tcx) {
let mut visitor =
ForeignFunctionTransformer { tcx, local_decls: body.clone().local_decls, stub_map };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should do body.local_decls.clone() instead.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Stub of extern functions including C-FFI
3 participants