rust/src/librustc_save_analysis
bors 1999a22881 Auto merge of #57760 - dlrobertson:varargs1, r=alexreg
Support defining C compatible variadic functions

## Summary

Add support for defining C compatible variadic functions in unsafe rust with
`extern "C"` according to [RFC 2137].

## Details

### Parsing
When parsing a user defined function that is `unsafe` and `extern "C"` allow
variadic signatures and inject a "spoofed" `VaList` in the new functions
signature. This allows the user to interact with the variadic arguments via a
`VaList` instead of manually using `va_start` and `va_end` (See [RFC 2137] for
details).

### Codegen

When running codegen for a variadic function, remove the "spoofed" `VaList`
from the function signature and inject `va_start` when the arg local
references are created for the function and `va_end` on return.

## TODO

 - [x] Get feedback on injecting `va_start/va_end` in MIR vs codegen
 - [x] Properly inject `va_end` - It seems like it should be possible to inject
       `va_end` on the `TerminatorKind::Return`. I just need to figure out how
       to get the `LocalRef` here.
 - [x] Properly call Rust defined C variadic functions in Rust - The spoofed
       `VaList` causes problems here.

Related to: #44930

r? @ghost

[RFC 2137]: https://github.com/rust-lang/rfcs/blob/master/text/2137-variadic.md
2019-02-28 15:00:25 +00:00
..
Cargo.toml librustc_save_analysis => 2018 2019-02-07 01:02:00 +09:00
dump_visitor.rs hir: remove NodeId from Expr 2019-02-24 17:09:37 +01:00
json_dumper.rs librustc_save_analysis => 2018 2019-02-07 01:02:00 +09:00
lib.rs hir: remove NodeId from Lifetime and Ty 2019-02-24 07:50:44 +01:00
sig.rs Auto merge of #57760 - dlrobertson:varargs1, r=alexreg 2019-02-28 15:00:25 +00:00
span_utils.rs librustc_save_analysis => 2018 2019-02-07 01:02:00 +09:00