mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-26 01:23:13 +01:00
DMD Issue 4523 - [tdpl] .remove method for Associative Arrays returns void in all cases
This commit is contained in:
12
gen/aa.cpp
12
gen/aa.cpp
@@ -191,7 +191,7 @@ DValue* DtoAAIn(Loc& loc, Type* type, DValue* aa, DValue* key)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void DtoAARemove(Loc& loc, DValue* aa, DValue* key)
|
||||
DValue *DtoAARemove(Loc& loc, DValue* aa, DValue* key)
|
||||
{
|
||||
// D1:
|
||||
// call:
|
||||
@@ -199,7 +199,7 @@ void DtoAARemove(Loc& loc, DValue* aa, DValue* key)
|
||||
|
||||
// D2:
|
||||
// call:
|
||||
// extern(C) void _aaDelX(AA aa, TypeInfo keyti, void* pkey)
|
||||
// extern(C) bool _aaDelX(AA aa, TypeInfo keyti, void* pkey)
|
||||
|
||||
// first get the runtime function
|
||||
#if DMDV2
|
||||
@@ -240,7 +240,13 @@ void DtoAARemove(Loc& loc, DValue* aa, DValue* key)
|
||||
args.push_back(pkey);
|
||||
|
||||
// call runtime
|
||||
gIR->CreateCallOrInvoke(func, args);
|
||||
LLCallSite call = gIR->CreateCallOrInvoke(func, args);
|
||||
|
||||
#if DMDV2
|
||||
return new DImValue(Type::tbool, call.getInstruction());
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
2
gen/aa.h
2
gen/aa.h
@@ -3,7 +3,7 @@
|
||||
|
||||
DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key, bool lvalue);
|
||||
DValue* DtoAAIn(Loc& loc, Type* type, DValue* aa, DValue* key);
|
||||
void DtoAARemove(Loc& loc, DValue* aa, DValue* key);
|
||||
DValue* DtoAARemove(Loc& loc, DValue* aa, DValue* key);
|
||||
LLValue* DtoAAEquals(Loc& loc, TOK op, DValue* l, DValue* r);
|
||||
|
||||
#endif // LDC_GEN_AA_H
|
||||
|
||||
@@ -874,18 +874,20 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
// D1:
|
||||
// void _aaDel(AA aa, TypeInfo keyti, void* pkey)
|
||||
// D2:
|
||||
// void _aaDelX(AA aa, TypeInfo keyti, void* pkey)
|
||||
// bool _aaDelX(AA aa, TypeInfo keyti, void* pkey)
|
||||
{
|
||||
#if DMDV2
|
||||
llvm::StringRef fname("_aaDelX");
|
||||
LLType *retType = boolTy;
|
||||
#else
|
||||
llvm::StringRef fname("_aaDel");
|
||||
LLType *retType = voidTy;
|
||||
#endif
|
||||
std::vector<LLType*> types;
|
||||
types.push_back(aaTy);
|
||||
types.push_back(typeInfoTy);
|
||||
types.push_back(voidPtrTy);
|
||||
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
|
||||
LLFunctionType* fty = llvm::FunctionType::get(retType, types, false);
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
|
||||
->setAttributes(Attr_1_3_NoCapture);
|
||||
}
|
||||
|
||||
@@ -2988,9 +2988,7 @@ DValue* RemoveExp::toElem(IRState* p)
|
||||
DValue* aa = e1->toElem(p);
|
||||
DValue* key = e2->toElem(p);
|
||||
|
||||
DtoAARemove(loc, aa, key);
|
||||
|
||||
return NULL; // does not produce anything useful
|
||||
return DtoAARemove(loc, aa, key);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user