mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00

Did a lot of smaller cleans up here and there. Replaced more llvm::Foo with LLFoo for common stuff. Split up tollvm.cpp.
25 lines
506 B
C++
25 lines
506 B
C++
#include "gen/llvm.h"
|
|
#include "llvm/Linker.h"
|
|
|
|
#include "root.h"
|
|
#include "mars.h"
|
|
|
|
typedef std::vector<llvm::Module*> Module_vector;
|
|
|
|
void linkModules(llvm::Module* dst, const Module_vector& MV)
|
|
{
|
|
if (MV.empty())
|
|
return;
|
|
|
|
llvm::Linker linker("llvmdc", dst);
|
|
|
|
std::string err;
|
|
for (Module_vector::const_iterator i=MV.begin(); i!=MV.end(); ++i)
|
|
{
|
|
if (!linker.LinkInModule(*i, &err))
|
|
{
|
|
error("%s", err.c_str());
|
|
fatal();
|
|
}
|
|
}
|
|
}
|