Mercurial > projects > ldc
diff gen/toobj.cpp @ 1478:4dca8ed9d8b7
Fix #318 by making a list of all seen template instances in a module for
singleobj compilation and then making sure they get emitted in their entirety.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 06 Jun 2009 09:47:32 +0200 |
parents | 630fc54f7c1e |
children | 2292878925f4 |
line wrap: on
line diff
--- a/gen/toobj.cpp Fri Jun 05 02:54:34 2009 +0200 +++ b/gen/toobj.cpp Sat Jun 06 09:47:32 2009 +0200 @@ -142,6 +142,21 @@ // emit function bodies sir->emitFunctionBodies(); + // for singleobj-compilation, fully emit all seen template instances + if (opts::singleObj) + { + while (!ir.seenTemplateInstances.empty()) + { + IRState::TemplateInstanceSet::iterator it, end = ir.seenTemplateInstances.end(); + for (it = ir.seenTemplateInstances.begin(); it != end; ++it) + (*it)->codegen(sir); + ir.seenTemplateInstances.clear(); + + // emit any newly added function bodies + sir->emitFunctionBodies(); + } + } + // generate ModuleInfo genmoduleinfo();