Mercurial > projects > ldc
comparison gen/classes.cpp @ 348:3c5e19bfcbf2 trunk
[svn r369] Fix nested classes when nestedVar is not generated.
author | ChristianK |
---|---|
date | Sun, 13 Jul 2008 21:16:40 +0200 |
parents | 6057fdf797d8 |
children | 4d7495038ae8 |
comparison
equal
deleted
inserted
replaced
347:6057fdf797d8 | 348:3c5e19bfcbf2 |
---|---|
835 // set the context for nested classes | 835 // set the context for nested classes |
836 else if (tc->sym->isNested()) | 836 else if (tc->sym->isNested()) |
837 { | 837 { |
838 Logger::println("Resolving nested context"); | 838 Logger::println("Resolving nested context"); |
839 LOG_SCOPE; | 839 LOG_SCOPE; |
840 // this value might be zero if it was not necessary to generate it ... | |
840 LLValue* nest = gIR->func()->nestedVar; | 841 LLValue* nest = gIR->func()->nestedVar; |
842 // ... then revert to the this ptr if there is one | |
841 if (!nest) | 843 if (!nest) |
842 nest = gIR->func()->thisVar; | 844 nest = gIR->func()->thisVar; |
845 // ... or just use zero, since it must be unused. | |
846 if (!nest) | |
847 nest = llvm::ConstantPointerNull::get(getVoidPtrType()); | |
843 assert(nest); | 848 assert(nest); |
844 LLValue* gep = DtoGEPi(mem,0,2,"tmp"); | 849 LLValue* gep = DtoGEPi(mem,0,2,"tmp"); |
845 nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); | 850 nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); |
846 DtoStore(nest, gep); | 851 DtoStore(nest, gep); |
847 } | 852 } |