Fix and refactor Objective-C state

Tie the state to an LLVM module/object file instead of having a global
one. And finalize it once per LLVM module instead of once per D module
(previously, as part of ModuleInfo generation).

Fixes issue #2388.
This commit is contained in:
Martin 2017-10-26 20:24:03 +02:00
parent 183f97cd4e
commit 95915a8ab8
9 changed files with 130 additions and 112 deletions

View file

@ -247,6 +247,8 @@ void CodeGenerator::finishLLModule(Module *m) {
}
void CodeGenerator::writeAndFreeLLModule(const char *filename) {
ir_->objc.finalize();
// Issue #1829: make sure all replaced global variables are replaced
// everywhere.
ir_->replaceGlobals();