comparison gen/toobj.cpp @ 683:b411c41a9716

Only allocate the module file name once. Fixes #90.
author Christian Kamm <kamm incasoftware de>
date Sun, 12 Oct 2008 10:35:16 +0200
parents 075c1272a01d
children 363bb6c0cc80
comparison
equal deleted inserted replaced
682:518b8cc84369 683:b411c41a9716
87 87
88 // reset all IR data stored in Dsymbols and Types 88 // reset all IR data stored in Dsymbols and Types
89 IrDsymbol::resetAll(); 89 IrDsymbol::resetAll();
90 IrType::resetAll(); 90 IrType::resetAll();
91 91
92 // module ir state
93 // might already exist via import, just overwrite...
94 this->ir.irModule = new IrModule(this);
95
96 // name the module 92 // name the module
97 std::string mname(toChars()); 93 std::string mname(toChars());
98 if (md != 0) 94 if (md != 0)
99 mname = md->toChars(); 95 mname = md->toChars();
100 ir.module = new llvm::Module(mname); 96 ir.module = new llvm::Module(mname);
97
98 // module ir state
99 // might already exist via import, just overwrite...
100 //FIXME: is there a good reason for overwriting?
101 this->ir.irModule = new IrModule(this, srcfile->toChars());
101 102
102 // set target stuff 103 // set target stuff
103 std::string target_triple(global.params.tt_arch); 104 std::string target_triple(global.params.tt_arch);
104 target_triple.append(global.params.tt_os); 105 target_triple.append(global.params.tt_os);
105 ir.module->setTargetTriple(target_triple); 106 ir.module->setTargetTriple(target_triple);