Mercurial > projects > ldc
comparison gen/toir.cpp @ 1534:8ca25bd765a3
Build fix for the latest LLVMContext changes (LLVM r75445)
This shouldn't break the build with older LLVM revs. We include
LLVMContext.h in gen/llvm.h now to make the transition a little bit
easier.
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Mon, 13 Jul 2009 12:17:58 +0200 |
parents | ad7f2f1862d6 |
children | 61f12f4651b5 |
comparison
equal
deleted
inserted
replaced
1533:d1652c8fb4f6 | 1534:8ca25bd765a3 |
---|---|
339 if (type->ty == Tarray) { | 339 if (type->ty == Tarray) { |
340 assert(isaStruct(t)); | 340 assert(isaStruct(t)); |
341 return llvm::ConstantAggregateZero::get(t); | 341 return llvm::ConstantAggregateZero::get(t); |
342 } | 342 } |
343 else { | 343 else { |
344 return llvm::Constant::getNullValue(t); | 344 return llvm::getGlobalContext().getNullValue(t); |
345 } | 345 } |
346 assert(0); | 346 assert(0); |
347 return NULL; | 347 return NULL; |
348 } | 348 } |
349 | 349 |
1654 if (et->ty == Tpointer) | 1654 if (et->ty == Tpointer) |
1655 { | 1655 { |
1656 LLValue* rval = dval->getRVal(); | 1656 LLValue* rval = dval->getRVal(); |
1657 DtoDeleteMemory(rval); | 1657 DtoDeleteMemory(rval); |
1658 if (dval->isVar()) | 1658 if (dval->isVar()) |
1659 DtoStore(llvm::Constant::getNullValue(rval->getType()), dval->getLVal()); | 1659 DtoStore(llvm::getGlobalContext().getNullValue(rval->getType()), dval->getLVal()); |
1660 } | 1660 } |
1661 // class | 1661 // class |
1662 else if (et->ty == Tclass) | 1662 else if (et->ty == Tclass) |
1663 { | 1663 { |
1664 bool onstack = false; | 1664 bool onstack = false; |
1678 LLValue* rval = dval->getRVal(); | 1678 LLValue* rval = dval->getRVal(); |
1679 DtoDeleteClass(rval); | 1679 DtoDeleteClass(rval); |
1680 } | 1680 } |
1681 if (dval->isVar()) { | 1681 if (dval->isVar()) { |
1682 LLValue* lval = dval->getLVal(); | 1682 LLValue* lval = dval->getLVal(); |
1683 DtoStore(llvm::Constant::getNullValue(lval->getType()->getContainedType(0)), lval); | 1683 DtoStore(llvm::getGlobalContext().getNullValue(lval->getType()->getContainedType(0)), lval); |
1684 } | 1684 } |
1685 } | 1685 } |
1686 // dyn array | 1686 // dyn array |
1687 else if (et->ty == Tarray) | 1687 else if (et->ty == Tarray) |
1688 { | 1688 { |
2545 Type* vtype = aatype->nextOf(); | 2545 Type* vtype = aatype->nextOf(); |
2546 | 2546 |
2547 // it should be possible to avoid the temporary in some cases | 2547 // it should be possible to avoid the temporary in some cases |
2548 LLValue* tmp = DtoAlloca(type,"aaliteral"); | 2548 LLValue* tmp = DtoAlloca(type,"aaliteral"); |
2549 DValue* aa = new DVarValue(type, tmp); | 2549 DValue* aa = new DVarValue(type, tmp); |
2550 DtoStore(LLConstant::getNullValue(DtoType(type)), tmp); | 2550 DtoStore(llvm::getGlobalContext().getNullValue(DtoType(type)), tmp); |
2551 | 2551 |
2552 const size_t n = keys->dim; | 2552 const size_t n = keys->dim; |
2553 for (size_t i=0; i<n; ++i) | 2553 for (size_t i=0; i<n; ++i) |
2554 { | 2554 { |
2555 Expression* ekey = (Expression*)keys->data[i]; | 2555 Expression* ekey = (Expression*)keys->data[i]; |