Mercurial > projects > ldc
diff gen/aa.cpp @ 458:121624c14053
Fixed AA Rvalue-only access (like indexing an AA return value immediately).
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Sat, 02 Aug 2008 22:35:24 +0200 |
parents | d3d3519b72e8 |
children | 45a67b6f1310 |
line wrap: on
line diff
--- a/gen/aa.cpp Sat Aug 02 21:51:49 2008 +0200 +++ b/gen/aa.cpp Sat Aug 02 22:35:24 2008 +0200 @@ -66,17 +66,19 @@ ///////////////////////////////////////////////////////////////////////////////////// -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