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

@ -15,7 +15,6 @@
#include "gen/llvmhelpers.h"
#include "gen/logger.h"
#include "gen/mangling.h"
#include "gen/objcgen.h"
#include "gen/rttibuilder.h"
#include "ir/irfunction.h"
#include "ir/irmodule.h"
@ -306,8 +305,6 @@ llvm::GlobalVariable *genModuleInfo(Module *m) {
const auto at = llvm::ArrayType::get(it, len);
b.push(toConstantArray(it, at, name, len, false));
objc_Module_genmoduleinfo_classes();
// Create a global symbol with the above initialiser.
LLGlobalVariable *moduleInfoSym = getIrModule(m)->moduleInfoSymbol();
b.finalize(moduleInfoSym->getType()->getPointerElementType(), moduleInfoSym);