[LLVMbugs] [Bug 5064] New: Support byval the msvc++ way.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Sep 26 20:15:35 PDT 2009


           Summary: Support byval the msvc++ way.
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ofv at wanadoo.es
                CC: llvmbugs at cs.uiuc.edu

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.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list