mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
Apply patch from klickverbot. This is his 'proper fix' patch for bug #395.
This commit is contained in:
parent
902bc06fb1
commit
b38845e88e
6 changed files with 45 additions and 51 deletions
|
@ -1572,3 +1572,36 @@ Type * stripModifiers( Type * type )
|
|||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLValue* makeLValue(Loc& loc, DValue* value)
|
||||
{
|
||||
Type* valueType = value->getType();
|
||||
bool needsMemory;
|
||||
LLValue* valuePointer;
|
||||
if (value->isIm()) {
|
||||
valuePointer = value->getRVal();
|
||||
needsMemory = !DtoIsPassedByRef(valueType);
|
||||
}
|
||||
else if (DVarValue* var = value->isVar()) {
|
||||
valuePointer = value->getLVal();
|
||||
needsMemory = false;
|
||||
}
|
||||
else if (value->isConst()) {
|
||||
valuePointer = value->getRVal();
|
||||
needsMemory = true;
|
||||
}
|
||||
else {
|
||||
valuePointer = DtoAlloca(valueType, ".makelvaluetmp");
|
||||
DVarValue var(valueType, valuePointer);
|
||||
DtoAssign(loc, &var, value);
|
||||
needsMemory = false;
|
||||
}
|
||||
|
||||
if (needsMemory) {
|
||||
LLValue* tmp = DtoAlloca(valueType, ".makelvaluetmp");
|
||||
DtoStore(valuePointer, tmp);
|
||||
valuePointer = tmp;
|
||||
}
|
||||
|
||||
return valuePointer;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue