Skip to content

Support byval the msvc++ way. #5436

@oscarfv

Description

@oscarfv
mannequin
Bugzilla Link 5064
Resolution FIXED
Resolved on Feb 27, 2014 18:23
Version trunk
OS Windows XP
Blocks llvm/llvm-bugzilla-archive#12477 llvm/llvm-bugzilla-archive#17167
CC @asl,@tritao,@rnk,@timurrrr

Extended Description

When a C++ struct function argument has a destructor or copy constructor and is passed by value, GCC creates a temporary copy somewhere and passes a pointer to the temporary copy to the function. LLVM does not support this directly and is the front-end the responsible of creating the temporary and use the pointer as the function's parameter.

MSVC++ does not use this trick: the C++ class is put on the stack along with the rest of function parameters. As LLVM is the responsible of arranging the parameters on the stack for the function call, this requires that LLVM know about the copy constructor and the destructor.

Right now there is no workaround for this, so LLVM code is unable to call functions compiled with MSVC++ that take C++ classes by value (when those classes have a copy constructor and/or destructor).

LLVM's byval should be extended to allow the front-end to specify a copy constructor and a destructor, and insert calls to them when the temporary is created and after the call is performed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions