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:
David Nadlinger
2012-09-28 00:28:49 +02:00
parent e7c72b072b
commit c6abdcf4a4
7 changed files with 19 additions and 11 deletions

View File

@@ -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");