Mercurial > projects > ldc
comparison gen/toir.cpp @ 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 | 0084d2c76b74 |
comparison
equal
deleted
inserted
replaced
628:e3c46bcce65f | 629:607b6b5819a7 |
---|---|
1952 { | 1952 { |
1953 eval = (op == TOKidentity) | 1953 eval = (op == TOKidentity) |
1954 ? p->ir->CreateFCmpOEQ(l,r,"tmp") | 1954 ? p->ir->CreateFCmpOEQ(l,r,"tmp") |
1955 : p->ir->CreateFCmpONE(l,r,"tmp"); | 1955 : p->ir->CreateFCmpONE(l,r,"tmp"); |
1956 } | 1956 } |
1957 else if (t1->ty == Tpointer) | 1957 else if (t1->ty == Tpointer || t1->ty == Tclass) |
1958 { | 1958 { |
1959 if (l->getType() != r->getType()) { | 1959 if (l->getType() != r->getType()) { |
1960 if (v->isNull()) | 1960 if (v->isNull()) |
1961 r = llvm::ConstantPointerNull::get(isaPointer(l->getType())); | 1961 r = llvm::ConstantPointerNull::get(isaPointer(l->getType())); |
1962 else | 1962 else |
1965 eval = (op == TOKidentity) | 1965 eval = (op == TOKidentity) |
1966 ? p->ir->CreateICmpEQ(l,r,"tmp") | 1966 ? p->ir->CreateICmpEQ(l,r,"tmp") |
1967 : p->ir->CreateICmpNE(l,r,"tmp"); | 1967 : p->ir->CreateICmpNE(l,r,"tmp"); |
1968 } | 1968 } |
1969 else { | 1969 else { |
1970 assert(l->getType() == r->getType()); | |
1970 eval = (op == TOKidentity) | 1971 eval = (op == TOKidentity) |
1971 ? p->ir->CreateICmpEQ(l,r,"tmp") | 1972 ? p->ir->CreateICmpEQ(l,r,"tmp") |
1972 : p->ir->CreateICmpNE(l,r,"tmp"); | 1973 : p->ir->CreateICmpNE(l,r,"tmp"); |
1973 } | 1974 } |
1974 return new DImValue(type, eval); | 1975 return new DImValue(type, eval); |