Fixed issue with IsExpression and potential type mismatch for classes.

This commit is contained in:
Tomas Lindquist Olsen
2008-10-01 20:55:13 +02:00
parent 32c4f92334
commit e7ad7296d0
2 changed files with 5 additions and 1 deletions

View File

@@ -17,6 +17,9 @@
#include "llvm/Support/IRBuilder.h"
using llvm::IRBuilder;
// for WriteTypeSymbolic
#include "llvm/Assembly/Writer.h"
#define GET_INTRINSIC_DECL(_X) (llvm::Intrinsic::getDeclaration(gIR->module, llvm::Intrinsic:: _X ))
// shortcuts for the common llvm types

View File

@@ -1954,7 +1954,7 @@ DValue* IdentityExp::toElem(IRState* p)
? p->ir->CreateFCmpOEQ(l,r,"tmp")
: p->ir->CreateFCmpONE(l,r,"tmp");
}
else if (t1->ty == Tpointer)
else if (t1->ty == Tpointer || t1->ty == Tclass)
{
if (l->getType() != r->getType()) {
if (v->isNull())
@@ -1967,6 +1967,7 @@ DValue* IdentityExp::toElem(IRState* p)
: p->ir->CreateICmpNE(l,r,"tmp");
}
else {
assert(l->getType() == r->getType());
eval = (op == TOKidentity)
? p->ir->CreateICmpEQ(l,r,"tmp")
: p->ir->CreateICmpNE(l,r,"tmp");