mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-28 17:43:14 +01:00
Fixed AA Rvalue-only access (like indexing an AA return value immediately).
This commit is contained in:
10
gen/aa.cpp
10
gen/aa.cpp
@@ -66,17 +66,19 @@ static LLValue* to_keyti(DValue* key)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key)
|
||||
DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key, bool lvalue)
|
||||
{
|
||||
// call:
|
||||
// extern(C) void* _aaGet(AA* aa, TypeInfo keyti, void* pkey, size_t valuesize)
|
||||
// extern(C) void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey)
|
||||
// or
|
||||
// extern(C) void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey)
|
||||
|
||||
// first get the runtime function
|
||||
llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_aaGet");
|
||||
llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, lvalue?"_aaGet":"_aaGetRvalue");
|
||||
const llvm::FunctionType* funcTy = func->getFunctionType();
|
||||
|
||||
// aa param
|
||||
LLValue* aaval = aa->getLVal();
|
||||
LLValue* aaval = lvalue ? aa->getLVal() : aa->getRVal();
|
||||
aaval = DtoBitCast(aaval, funcTy->getParamType(0));
|
||||
|
||||
// keyti param
|
||||
|
||||
Reference in New Issue
Block a user