mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-17 17:29:02 +02:00
Don't set TypePointer::isunsigned to true in the frontend.
The previous solution was problematic because the change was language- visble via the isUnsigned trait. Now, pointers are simply explicitly checked for in the relevant places. (Note that there might be cases in the diff where a direct isunsigned() call would have been appropriate – I only checked for instances where the type clearly cannot be a pointer, but chose to go the safe route in replicating existing behavior otherwise). Fixes DMD testcase 'traits'.
This commit is contained in:
@@ -1714,8 +1714,7 @@ DValue* CmpExp::toElem(IRState* p)
|
||||
{
|
||||
llvm::ICmpInst::Predicate cmpop;
|
||||
bool skip = false;
|
||||
// pointers don't report as being unsigned
|
||||
bool uns = (t->isunsigned() || t->ty == Tpointer);
|
||||
bool uns = isLLVMUnsigned(t);
|
||||
switch(op)
|
||||
{
|
||||
case TOKlt:
|
||||
@@ -2351,7 +2350,7 @@ DValue* ShrExp::toElem(IRState* p)
|
||||
DValue* u = e1->toElem(p);
|
||||
DValue* v = e2->toElem(p);
|
||||
LLValue* x;
|
||||
if (e1->type->isunsigned())
|
||||
if (isLLVMUnsigned(e1->type))
|
||||
x = p->ir->CreateLShr(u->getRVal(), v->getRVal(), "tmp");
|
||||
else
|
||||
x = p->ir->CreateAShr(u->getRVal(), v->getRVal(), "tmp");
|
||||
|
||||
Reference in New Issue
Block a user