From e7ad7296d0784f84d9f78c35d32686aa99fbb268 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Wed, 1 Oct 2008 20:55:13 +0200 Subject: [PATCH] Fixed issue with IsExpression and potential type mismatch for classes. --- gen/llvm.h | 3 +++ gen/toir.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gen/llvm.h b/gen/llvm.h index a90f2f4f..104e108b 100644 --- a/gen/llvm.h +++ b/gen/llvm.h @@ -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 diff --git a/gen/toir.cpp b/gen/toir.cpp index 4fa886df..d6247a0d 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -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");