changeset 629:607b6b5819a7

Fixed issue with IsExpression and potential type mismatch for classes.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 01 Oct 2008 20:55:13 +0200
parents e3c46bcce65f
children 9fcb5f1a4c54 df196c8dea26
files gen/llvm.h gen/toir.cpp
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gen/llvm.h	Wed Oct 01 20:32:12 2008 +0200
+++ b/gen/llvm.h	Wed Oct 01 20:55:13 2008 +0200
@@ -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
--- a/gen/toir.cpp	Wed Oct 01 20:32:12 2008 +0200
+++ b/gen/toir.cpp	Wed Oct 01 20:55:13 2008 +0200
@@ -1954,7 +1954,7 @@
         ?   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 @@
         :   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");