mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 15:40:55 +03:00
Fix for issue #624
This commit is contained in:
parent
0d6c556e50
commit
5372e57595
1 changed files with 11 additions and 2 deletions
|
@ -138,8 +138,17 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
|||
{
|
||||
#if LDC_LLVM_VER >= 303
|
||||
llvm::AttrBuilder attrBuilder;
|
||||
if (isCtor)
|
||||
attrBuilder.addAttribute(llvm::Attribute::Returned);
|
||||
// Issue 624: In case of a ctor 'this' is passed to the function and is also
|
||||
// the return value. This could be a perfect case for the 'Returned' attribute.
|
||||
// However the 'this' type and the return type are transformed in different
|
||||
// ways, making them bitcast incompatible.
|
||||
// Example: extern(C): struct Value { this(string) {} string s; }
|
||||
// return type: { i64, i64 }
|
||||
// this type: %ldc_github_624.Value*
|
||||
// FIXME: (1) Investigate why the types are handled in different ways
|
||||
// (2) The attributes are cleared by some abi implementations
|
||||
// if (isCtor)
|
||||
// attrBuilder.addAttribute(llvm::Attribute::Returned);
|
||||
#endif
|
||||
newIrFty.arg_this = new IrFuncTyArg(thistype, thistype->toBasetype()->ty == Tstruct
|
||||
#if LDC_LLVM_VER >= 303
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue