]> git.lizzy.rs Git - rust.git/commit
Add missing attributes to indirect calls for foreign functions
authorBjörn Steinbrink <bsteinbr@gmail.com>
Tue, 17 Jun 2014 19:51:24 +0000 (21:51 +0200)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Sat, 21 Jun 2014 17:59:58 +0000 (19:59 +0200)
commit5e720aac4215dcd8ba1b0fd455a737d8798baea4
tree18e1cf73c604f93a36dab9c66dbefc46731dc969
parentabdbaa2e19dcf6859ae781bb9b44fed483181229
Add missing attributes to indirect calls for foreign functions

When calling a foreign function, some arguments and/or return value
attributes are required to conform to the foreign ABI. Currently those
attributes are only added to the declaration of foreign functions. With
direct calls, this is no problem, because LLVM can see that those
attributes apply to the call. But with an indirect call, LLVM cannot do
that and the attribute is missing.

To fix that, we have to add those attribute to the calls to foreign
functions as well.

This also allows to remove the special handling of the SRet attribute,
which is ABI-dependent and will be set via the `attr` field of the
return type's `ArgType`.
src/librustc/middle/trans/foreign.rs
src/rt/rust_test_helpers.c
src/test/run-pass/foreign-fn-with-byval.rs [new file with mode: 0644]