Instead of passing a std::string&, use the new diagnostic infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220608
91177308-0d34-0410-b5e6-
96231b3b80d8
12 files changed:
enum DiagnosticKind {
DK_InlineAsm,
DK_StackSize,
enum DiagnosticKind {
DK_InlineAsm,
DK_StackSize,
DK_DebugMetadataVersion,
DK_SampleProfile,
DK_OptimizationRemark,
DK_DebugMetadataVersion,
DK_SampleProfile,
DK_OptimizationRemark,
~LTOCodeGenerator();
// Merge given module, return true on success.
~LTOCodeGenerator();
// Merge given module, return true on success.
- bool addModule(struct LTOModule*, std::string &errMsg);
+ bool addModule(struct LTOModule *);
void setTargetOptions(TargetOptions options);
void setDebugInfo(lto_debug_model);
void setTargetOptions(TargetOptions options);
void setDebugInfo(lto_debug_model);
#define LLVM_LINKER_LINKER_H
#include "llvm/ADT/SmallPtrSet.h"
#define LLVM_LINKER_LINKER_H
#include "llvm/ADT/SmallPtrSet.h"
-class Comdat;
-class GlobalValue;
class StructType;
/// This class provides the core functionality of linking in LLVM. It keeps a
class StructType;
/// This class provides the core functionality of linking in LLVM. It keeps a
PreserveSource = 1 // Preserve the source module.
};
PreserveSource = 1 // Preserve the source module.
};
- Linker(Module *M, bool SuppressWarnings=false);
~Linker();
Module *getModule() const { return Composite; }
~Linker();
Module *getModule() const { return Composite; }
/// If \p ErrorMsg is not null, information about any error is written
/// to it.
/// Returns true on error.
/// If \p ErrorMsg is not null, information about any error is written
/// to it.
/// Returns true on error.
- bool linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg);
- bool linkInModule(Module *Src, std::string *ErrorMsg) {
- return linkInModule(Src, Linker::DestroySource, ErrorMsg);
+ bool linkInModule(Module *Src, unsigned Mode);
+ bool linkInModule(Module *Src) {
+ return linkInModule(Src, Linker::DestroySource);
- static bool LinkModules(Module *Dest, Module *Src, unsigned Mode,
- std::string *ErrorMsg);
+ static bool LinkModules(Module *Dest, Module *Src, unsigned Mode);
private:
Module *Composite;
SmallPtrSet<StructType*, 32> IdentifiedStructTypes;
private:
Module *Composite;
SmallPtrSet<StructType*, 32> IdentifiedStructTypes;
-
- bool SuppressWarnings;
};
} // End llvm namespace
};
} // End llvm namespace
initializeCFGSimplifyPassPass(R);
}
initializeCFGSimplifyPassPass(R);
}
-bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg) {
- bool ret = IRLinker.linkInModule(&mod->getModule(), &errMsg);
+bool LTOCodeGenerator::addModule(LTOModule *mod) {
+ bool ret = IRLinker.linkInModule(&mod->getModule());
const std::vector<const char*> &undefs = mod->getAsmUndefinedRefs();
for (int i = 0, e = undefs.size(); i != e; ++i)
const std::vector<const char*> &undefs = mod->getAsmUndefinedRefs();
for (int i = 0, e = undefs.size(); i != e; ++i)
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/IR/Constants.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/DiagnosticPrinter.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/TypeFinder.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/TypeFinder.h"
#include "llvm/Support/CommandLine.h"
Value *materializeValueFor(Value *V) override;
};
Value *materializeValueFor(Value *V) override;
};
+ namespace {
+ class LinkDiagnosticInfo : public DiagnosticInfo {
+ const Twine &Msg;
+
+ public:
+ LinkDiagnosticInfo(DiagnosticSeverity Severity, const Twine &Msg);
+ void print(DiagnosticPrinter &DP) const override;
+ };
+ LinkDiagnosticInfo::LinkDiagnosticInfo(DiagnosticSeverity Severity,
+ const Twine &Msg)
+ : DiagnosticInfo(DK_Linker, Severity), Msg(Msg) {}
+ void LinkDiagnosticInfo::print(DiagnosticPrinter &DP) const { DP << Msg; }
+ }
+
/// ModuleLinker - This is an implementation class for the LinkModules
/// function, which is the entrypoint for this file.
class ModuleLinker {
/// ModuleLinker - This is an implementation class for the LinkModules
/// function, which is the entrypoint for this file.
class ModuleLinker {
// Vector of functions to lazily link in.
std::vector<Function*> LazilyLinkFunctions;
// Vector of functions to lazily link in.
std::vector<Function*> LazilyLinkFunctions;
- bool SuppressWarnings;
-
- std::string ErrorMsg;
-
- ModuleLinker(Module *dstM, TypeSet &Set, Module *srcM, unsigned mode,
- bool SuppressWarnings=false)
+ ModuleLinker(Module *dstM, TypeSet &Set, Module *srcM, unsigned mode)
: DstM(dstM), SrcM(srcM), TypeMap(Set),
: DstM(dstM), SrcM(srcM), TypeMap(Set),
- ValMaterializer(TypeMap, DstM, LazilyLinkFunctions), Mode(mode),
- SuppressWarnings(SuppressWarnings) {}
+ ValMaterializer(TypeMap, DstM, LazilyLinkFunctions), Mode(mode) {}
- bool shouldLinkFromSource(const GlobalValue &Dest, const GlobalValue &Src);
+ bool shouldLinkFromSource(bool &LinkFromSrc, const GlobalValue &Dest,
+ const GlobalValue &Src);
- /// emitError - Helper method for setting a message and returning an error
- /// code.
+ /// Helper method for setting a message and returning an error code.
bool emitError(const Twine &Message) {
bool emitError(const Twine &Message) {
- ErrorMsg = Message.str();
+ DstM->getContext().diagnose(LinkDiagnosticInfo(DS_Error, Message));
+ void emitWarning(const Twine &Message) {
+ DstM->getContext().diagnose(LinkDiagnosticInfo(DS_Warning, Message));
+ }
+
bool getComdatLeader(Module *M, StringRef ComdatName,
const GlobalVariable *&GVar);
bool computeResultingSelectionKind(StringRef ComdatName,
bool getComdatLeader(Module *M, StringRef ComdatName,
const GlobalVariable *&GVar);
bool computeResultingSelectionKind(StringRef ComdatName,
-bool ModuleLinker::shouldLinkFromSource(const GlobalValue &Dest,
+bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc,
+ const GlobalValue &Dest,
const GlobalValue &Src) {
bool SrcIsDeclaration = Src.isDeclarationForLinker();
bool DestIsDeclaration = Dest.isDeclarationForLinker();
const GlobalValue &Src) {
bool SrcIsDeclaration = Src.isDeclarationForLinker();
bool DestIsDeclaration = Dest.isDeclarationForLinker();
if (SrcIsDeclaration) {
// If Src is external or if both Src & Dest are external.. Just link the
// external globals, we aren't adding anything.
if (SrcIsDeclaration) {
// If Src is external or if both Src & Dest are external.. Just link the
// external globals, we aren't adding anything.
- if (Src.hasDLLImportStorageClass())
+ if (Src.hasDLLImportStorageClass()) {
// If one of GVs is marked as DLLImport, result should be dllimport'ed.
// If one of GVs is marked as DLLImport, result should be dllimport'ed.
- return DestIsDeclaration;
+ LinkFromSrc = DestIsDeclaration;
+ return false;
+ }
// If the Dest is weak, use the source linkage.
// If the Dest is weak, use the source linkage.
- return Dest.hasExternalWeakLinkage();
+ LinkFromSrc = Dest.hasExternalWeakLinkage();
+ return false;
+ if (DestIsDeclaration) {
// If Dest is external but Src is not:
// If Dest is external but Src is not:
+ LinkFromSrc = true;
+ return false;
+ }
if (Src.hasCommonLinkage()) {
if (Src.hasCommonLinkage()) {
- if (Dest.hasLinkOnceLinkage() || Dest.hasWeakLinkage())
- return true;
+ if (Dest.hasLinkOnceLinkage() || Dest.hasWeakLinkage()) {
+ LinkFromSrc = true;
+ return false;
+ }
- if (!Dest.hasCommonLinkage())
+ if (!Dest.hasCommonLinkage()) {
+ LinkFromSrc = false;
uint64_t DestSize = DL.getTypeAllocSize(Dest.getType()->getElementType());
uint64_t SrcSize = DL.getTypeAllocSize(Src.getType()->getElementType());
uint64_t DestSize = DL.getTypeAllocSize(Dest.getType()->getElementType());
uint64_t SrcSize = DL.getTypeAllocSize(Src.getType()->getElementType());
- return SrcSize > DestSize;
+ LinkFromSrc = SrcSize > DestSize;
+ return false;
}
if (Src.isWeakForLinker()) {
assert(!Dest.hasExternalWeakLinkage());
assert(!Dest.hasAvailableExternallyLinkage());
}
if (Src.isWeakForLinker()) {
assert(!Dest.hasExternalWeakLinkage());
assert(!Dest.hasAvailableExternallyLinkage());
- if (Dest.hasLinkOnceLinkage() && Src.hasWeakLinkage())
- return true;
+ if (Dest.hasLinkOnceLinkage() && Src.hasWeakLinkage()) {
+ LinkFromSrc = true;
+ return false;
+ }
return false;
}
if (Dest.isWeakForLinker()) {
assert(Src.hasExternalLinkage());
return false;
}
if (Dest.isWeakForLinker()) {
assert(Src.hasExternalLinkage());
+ LinkFromSrc = true;
+ return false;
}
assert(!Src.hasExternalWeakLinkage());
}
assert(!Src.hasExternalWeakLinkage());
assert(!Src->hasLocalLinkage() &&
"If Src has internal linkage, Dest shouldn't be set!");
assert(!Src->hasLocalLinkage() &&
"If Src has internal linkage, Dest shouldn't be set!");
- assert(ErrorMsg.empty());
- LinkFromSrc = shouldLinkFromSource(*Dest, *Src);
- if (!ErrorMsg.empty())
+ if (shouldLinkFromSource(LinkFromSrc, *Dest, *Src))
return true;
if (LinkFromSrc)
return true;
if (LinkFromSrc)
case Module::Warning: {
// Emit a warning if the values differ.
if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
case Module::Warning: {
// Emit a warning if the values differ.
if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
- if (!SuppressWarnings) {
- errs() << "WARNING: linking module flags '" << ID->getString()
- << "': IDs have conflicting values";
- }
+ emitWarning("linking module flags '" + ID->getString() +
+ "': IDs have conflicting values");
if (SrcM->getDataLayout() && DstM->getDataLayout() &&
*SrcM->getDataLayout() != *DstM->getDataLayout()) {
if (SrcM->getDataLayout() && DstM->getDataLayout() &&
*SrcM->getDataLayout() != *DstM->getDataLayout()) {
- if (!SuppressWarnings) {
- errs() << "WARNING: Linking two modules of different data layouts: '"
- << SrcM->getModuleIdentifier() << "' is '"
- << SrcM->getDataLayoutStr() << "' whereas '"
- << DstM->getModuleIdentifier() << "' is '"
- << DstM->getDataLayoutStr() << "'\n";
- }
+ emitWarning("Linking two modules of different data layouts: '" +
+ SrcM->getModuleIdentifier() + "' is '" +
+ SrcM->getDataLayoutStr() + "' whereas '" +
+ DstM->getModuleIdentifier() + "' is '" +
+ DstM->getDataLayoutStr() + "'\n");
}
if (!SrcM->getTargetTriple().empty() &&
DstM->getTargetTriple() != SrcM->getTargetTriple()) {
}
if (!SrcM->getTargetTriple().empty() &&
DstM->getTargetTriple() != SrcM->getTargetTriple()) {
- if (!SuppressWarnings) {
- errs() << "WARNING: Linking two modules of different target triples: "
- << SrcM->getModuleIdentifier() << "' is '"
- << SrcM->getTargetTriple() << "' whereas '"
- << DstM->getModuleIdentifier() << "' is '"
- << DstM->getTargetTriple() << "'\n";
- }
+ emitWarning("Linking two modules of different target triples: " +
+ SrcM->getModuleIdentifier() + "' is '" +
+ SrcM->getTargetTriple() + "' whereas '" +
+ DstM->getModuleIdentifier() + "' is '" +
+ DstM->getTargetTriple() + "'\n");
}
// Append the module inline asm string.
}
// Append the module inline asm string.
// Materialize if needed.
if (SF->isMaterializable()) {
// Materialize if needed.
if (SF->isMaterializable()) {
- if (std::error_code EC = SF->materialize()) {
- ErrorMsg = EC.message();
- return true;
- }
+ if (std::error_code EC = SF->materialize())
+ return emitError(EC.message());
}
// Skip if no body (function is external).
}
// Skip if no body (function is external).
// Materialize if needed.
if (SF->isMaterializable()) {
// Materialize if needed.
if (SF->isMaterializable()) {
- if (std::error_code EC = SF->materialize()) {
- ErrorMsg = EC.message();
- return true;
- }
+ if (std::error_code EC = SF->materialize())
+ return emitError(EC.message());
}
// Skip if no body (function is external).
}
// Skip if no body (function is external).
-Linker::Linker(Module *M, bool SuppressWarnings)
- : Composite(M), SuppressWarnings(SuppressWarnings) {
+Linker::Linker(Module *M) : Composite(M) {
TypeFinder StructTypes;
StructTypes.run(*M, true);
IdentifiedStructTypes.insert(StructTypes.begin(), StructTypes.end());
TypeFinder StructTypes;
StructTypes.run(*M, true);
IdentifiedStructTypes.insert(StructTypes.begin(), StructTypes.end());
-bool Linker::linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg) {
- ModuleLinker TheLinker(Composite, IdentifiedStructTypes, Src, Mode,
- SuppressWarnings);
- if (TheLinker.run()) {
- if (ErrorMsg)
- *ErrorMsg = TheLinker.ErrorMsg;
- return true;
- }
- return false;
+bool Linker::linkInModule(Module *Src, unsigned Mode) {
+ ModuleLinker TheLinker(Composite, IdentifiedStructTypes, Src, Mode);
+ return TheLinker.run();
}
//===----------------------------------------------------------------------===//
}
//===----------------------------------------------------------------------===//
/// error occurs, true is returned and ErrorMsg (if not null) is set to indicate
/// the problem. Upon failure, the Dest module could be in a modified state,
/// and shouldn't be relied on to be consistent.
/// error occurs, true is returned and ErrorMsg (if not null) is set to indicate
/// the problem. Upon failure, the Dest module could be in a modified state,
/// and shouldn't be relied on to be consistent.
-bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode,
- std::string *ErrorMsg) {
+bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode) {
- return L.linkInModule(Src, Mode, ErrorMsg);
+ return L.linkInModule(Src, Mode);
}
//===----------------------------------------------------------------------===//
}
//===----------------------------------------------------------------------===//
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
LLVMLinkerMode Mode, char **OutMessages) {
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
LLVMLinkerMode Mode, char **OutMessages) {
- std::string Messages;
- LLVMBool Result = Linker::LinkModules(unwrap(Dest), unwrap(Src),
- Mode, OutMessages? &Messages : nullptr);
- if (OutMessages)
- *OutMessages = strdup(Messages.c_str());
+ LLVMBool Result = Linker::LinkModules(unwrap(Dest), unwrap(Src), Mode);
if (!M.get()) return true;
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
if (!M.get()) return true;
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
- std::string ErrorMessage;
- if (Linker::LinkModules(Program, M.get(), Linker::DestroySource,
- &ErrorMessage)) {
- errs() << ToolName << ": error linking in '" << Filenames[i] << "': "
- << ErrorMessage << '\n';
+ if (Linker::LinkModules(Program, M.get(), Linker::DestroySource))
}
outs() << "*** All input ok\n";
}
outs() << "*** All input ok\n";
bool DeleteInputs, std::string &Error,
bool &Broken) {
// Link the two portions of the program back to together.
bool DeleteInputs, std::string &Error,
bool &Broken) {
// Link the two portions of the program back to together.
if (!DeleteInputs) {
M1 = CloneModule(M1);
M2 = CloneModule(M2);
}
if (!DeleteInputs) {
M1 = CloneModule(M1);
M2 = CloneModule(M2);
}
- if (Linker::LinkModules(M1, M2, Linker::DestroySource, &ErrorMsg)) {
- errs() << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ if (Linker::LinkModules(M1, M2, Linker::DestroySource))
delete M2; // We are done with this module.
// Execute the program.
delete M2; // We are done with this module.
// Execute the program.
F->getFunctionType()));
}
F->getFunctionType()));
}
- std::string ErrorMsg;
- if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted,
- Linker::DestroySource, &ErrorMsg)){
- errs() << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted,
+ Linker::DestroySource))
MiscompiledFunctions.clear();
for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) {
MiscompiledFunctions.clear();
for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) {
// extraction both didn't break the program, and didn't mask the problem.
// Replace the current program with the loop extracted version, and try to
// extract another loop.
// extraction both didn't break the program, and didn't mask the problem.
// Replace the current program with the loop extracted version, and try to
// extract another loop.
- std::string ErrorMsg;
- if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted,
- Linker::DestroySource, &ErrorMsg)){
- errs() << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted,
+ Linker::DestroySource))
delete ToOptimizeLoopExtracted;
// All of the Function*'s in the MiscompiledFunctions list are in the old
delete ToOptimizeLoopExtracted;
// All of the Function*'s in the MiscompiledFunctions list are in the old
MisCompFunctions.push_back(std::make_pair(I->getName(),
I->getFunctionType()));
MisCompFunctions.push_back(std::make_pair(I->getName(),
I->getFunctionType()));
- std::string ErrorMsg;
- if (Linker::LinkModules(ProgClone, Extracted.get(), Linker::DestroySource,
- &ErrorMsg)) {
- errs() << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ if (Linker::LinkModules(ProgClone, Extracted.get(), Linker::DestroySource))
// Set the new program and delete the old one.
BD.setNewProgram(ProgClone);
// Set the new program and delete the old one.
BD.setNewProgram(ProgClone);
M->setTargetTriple(DefaultTriple);
}
M->setTargetTriple(DefaultTriple);
}
- std::string ErrMsg;
- if (L.linkInModule(M.get(), &ErrMsg))
- message(LDPL_FATAL, "Failed to link module: %s", ErrMsg.c_str());
+ if (L.linkInModule(M.get()))
+ message(LDPL_FATAL, "Failed to link module");
}
for (const auto &Name : Internalize) {
}
for (const auto &Name : Internalize) {
#include "llvm/Linker/Linker.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Linker/Linker.h"
#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
+static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) {
+ unsigned Severity = DI.getSeverity();
+ switch (Severity) {
+ case DS_Error:
+ errs() << "ERROR: ";
+ case DS_Warning:
+ if (SuppressWarnings)
+ return;
+ errs() << "WARNING: ";
+ break;
+ case DS_Remark:
+ case DS_Note:
+ llvm_unreachable("Only expecting warnings and errors");
+ }
+
+ DiagnosticPrinterRawOStream DP(errs());
+ DI.print(DP);
+}
+
int main(int argc, char **argv) {
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
int main(int argc, char **argv) {
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
auto Composite = make_unique<Module>("llvm-link", Context);
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
auto Composite = make_unique<Module>("llvm-link", Context);
- Linker L(Composite.get(), SuppressWarnings);
+ Linker L(Composite.get());
- std::string ErrorMessage;
+ Context.setDiagnosticHandler(diagnosticHandler);
for (unsigned i = 0; i < InputFilenames.size(); ++i) {
std::unique_ptr<Module> M = loadFile(argv[0], InputFilenames[i], Context);
if (!M.get()) {
for (unsigned i = 0; i < InputFilenames.size(); ++i) {
std::unique_ptr<Module> M = loadFile(argv[0], InputFilenames[i], Context);
if (!M.get()) {
if (Verbose) errs() << "Linking in '" << InputFilenames[i] << "'\n";
if (Verbose) errs() << "Linking in '" << InputFilenames[i] << "'\n";
- if (L.linkInModule(M.get(), &ErrorMessage)) {
- errs() << argv[0] << ": link error in '" << InputFilenames[i]
- << "': " << ErrorMessage << "\n";
+ if (L.linkInModule(M.get()))
}
if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
}
if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
-
- if (!CodeGen.addModule(Module.get(), error)) {
- errs() << argv[0] << ": error adding file '" << InputFilenames[i]
- << "': " << error << "\n";
+ if (!CodeGen.addModule(Module.get()))
unsigned NumSyms = Module->getSymbolCount();
for (unsigned I = 0; I < NumSyms; ++I) {
unsigned NumSyms = Module->getSymbolCount();
for (unsigned I = 0; I < NumSyms; ++I) {
void lto_codegen_dispose(lto_code_gen_t cg) { delete unwrap(cg); }
bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
void lto_codegen_dispose(lto_code_gen_t cg) { delete unwrap(cg); }
bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
- return !unwrap(cg)->addModule(unwrap(mod), sLastErrorString);
+ return !unwrap(cg)->addModule(unwrap(mod));
}
bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {
}
bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {
Builder.CreateRet(ConstantPointerNull::get(Type::getInt8PtrTy(Ctx)));
Module *LinkedModule = new Module("MyModuleLinked", Ctx);
Builder.CreateRet(ConstantPointerNull::get(Type::getInt8PtrTy(Ctx)));
Module *LinkedModule = new Module("MyModuleLinked", Ctx);
- Linker::LinkModules(LinkedModule, M.get(), Linker::PreserveSource, nullptr);
+ Linker::LinkModules(LinkedModule, M.get(), Linker::PreserveSource);
// Delete the original module.
M.reset();
// Delete the original module.
M.reset();
GV->setInitializer(ConstantStruct::get(STy, F));
Module *EmptyM = new Module("EmptyModule1", Ctx);
GV->setInitializer(ConstantStruct::get(STy, F));
Module *EmptyM = new Module("EmptyModule1", Ctx);
- Linker::LinkModules(EmptyM, InternalM, Linker::PreserveSource, nullptr);
+ Linker::LinkModules(EmptyM, InternalM, Linker::PreserveSource);
delete EmptyM;
EmptyM = new Module("EmptyModule2", Ctx);
delete EmptyM;
EmptyM = new Module("EmptyModule2", Ctx);
- Linker::LinkModules(InternalM, EmptyM, Linker::PreserveSource, nullptr);
+ Linker::LinkModules(InternalM, EmptyM, Linker::PreserveSource);
delete EmptyM;
delete InternalM;
delete EmptyM;
delete InternalM;