mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-09-22 21:30:18 +02:00
Apply patch from klickverbot. This is his 'proper fix' patch for bug #395.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user