1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Delete the deprecated LLVMLinkModules.

llvm-svn: 260683
This commit is contained in:
Rafael Espindola 2016-02-12 15:28:45 +00:00
parent 2e0485683a
commit 36d363a08a
5 changed files with 3 additions and 77 deletions

View File

@ -35,11 +35,13 @@ Non-comprehensive list of changes in this release
=================================================
* .. note about autoconf build having been removed.
* .. note about C API functions LLVMLinkModules, LLVMParseBitcode,
* .. note about C API functions LLVMParseBitcode,
LLVMParseBitcodeInContext, LLVMGetBitcodeModuleInContext and
LLVMGetBitcodeModule having been removed. LLVMGetTargetMachineData has been
removed (use LLVMGetDataLayout instead).
* The C API function LLVMLinkModules has been removed.
.. NOTE
For small 1-3 sentence descriptions, just add an entry at the end of
this list. If your description won't fit comfortably in one bullet

View File

@ -27,20 +27,6 @@ typedef enum {
should not be used. */
} LLVMLinkerMode;
/* Links the source module into the destination module. The source module is
* damaged. The only thing that can be done is destroy it. Optionally returns a
* human-readable description of any errors that occurred in linking. OutMessage
* must be disposed with LLVMDisposeMessage. The return value is true if an
* error occurred, false otherwise.
*
* Note that the linker mode parameter \p Unused is no longer used, and has
* no effect.
*
* This function is deprecated. Use LLVMLinkModules2 instead.
*/
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
LLVMLinkerMode Unused, char **OutMessage);
/* Links the source module into the destination module. The source module is
* destroyed.
* The return value is true if an error occurred, false otherwise.

View File

@ -51,10 +51,6 @@ public:
DenseSet<const GlobalValue *> *FunctionsToImport = nullptr,
DenseMap<unsigned, MDNode *> *ValIDToTempMDMap = nullptr);
/// This exists to implement the deprecated LLVMLinkModules C api. Don't use
/// for anything else.
bool linkInModuleForCAPI(Module &Src);
static bool linkModules(Module &Dest, std::unique_ptr<Module> Src,
unsigned Flags = Flags::None);

View File

@ -557,11 +557,6 @@ bool Linker::linkInModule(std::unique_ptr<Module> Src, unsigned Flags,
return ModLinker.run();
}
bool Linker::linkInModuleForCAPI(Module &Src) {
ModuleLinker ModLinker(Mover, Src, 0, nullptr, nullptr);
return ModLinker.run();
}
bool Linker::linkInMetadata(Module &Src,
DenseMap<unsigned, MDNode *> *ValIDToTempMDMap) {
SetVector<GlobalValue *> ValuesToLink;
@ -592,35 +587,6 @@ bool Linker::linkModules(Module &Dest, std::unique_ptr<Module> Src,
// C API.
//===----------------------------------------------------------------------===//
static void diagnosticHandler(const DiagnosticInfo &DI, void *C) {
auto *Message = reinterpret_cast<std::string *>(C);
raw_string_ostream Stream(*Message);
DiagnosticPrinterRawOStream DP(Stream);
DI.print(DP);
}
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
LLVMLinkerMode Unused, char **OutMessages) {
Module *D = unwrap(Dest);
LLVMContext &Ctx = D->getContext();
LLVMContext::DiagnosticHandlerTy OldDiagnosticHandler =
Ctx.getDiagnosticHandler();
void *OldDiagnosticContext = Ctx.getDiagnosticContext();
std::string Message;
Ctx.setDiagnosticHandler(diagnosticHandler, &Message, true);
Linker L(*D);
Module *M = unwrap(Src);
LLVMBool Result = L.linkInModuleForCAPI(*M);
Ctx.setDiagnosticHandler(OldDiagnosticHandler, OldDiagnosticContext, true);
if (OutMessages && Result)
*OutMessages = strdup(Message.c_str());
return Result;
}
LLVMBool LLVMLinkModules2(LLVMModuleRef Dest, LLVMModuleRef Src) {
Module *D = unwrap(Dest);
std::unique_ptr<Module> M(unwrap(Src));

View File

@ -202,30 +202,6 @@ TEST_F(LinkModuleTest, TypeMerge) {
M1->getNamedGlobal("t2")->getType());
}
TEST_F(LinkModuleTest, CAPISuccess) {
std::unique_ptr<Module> DestM(getExternal(Ctx, "foo"));
std::unique_ptr<Module> SourceM(getExternal(Ctx, "bar"));
char *errout = nullptr;
LLVMBool result = LLVMLinkModules(wrap(DestM.get()), wrap(SourceM.get()),
LLVMLinkerDestroySource, &errout);
EXPECT_EQ(0, result);
EXPECT_EQ(nullptr, errout);
// "bar" is present in destination module
EXPECT_NE(nullptr, DestM->getFunction("bar"));
}
TEST_F(LinkModuleTest, CAPIFailure) {
// Symbol clash between two modules
std::unique_ptr<Module> DestM(getExternal(Ctx, "foo"));
std::unique_ptr<Module> SourceM(getExternal(Ctx, "foo"));
char *errout = nullptr;
LLVMBool result = LLVMLinkModules(wrap(DestM.get()), wrap(SourceM.get()),
LLVMLinkerDestroySource, &errout);
EXPECT_EQ(1, result);
EXPECT_STREQ("Linking globals named 'foo': symbol multiply defined!", errout);
LLVMDisposeMessage(errout);
}
TEST_F(LinkModuleTest, NewCAPISuccess) {
std::unique_ptr<Module> DestM(getExternal(Ctx, "foo"));
std::unique_ptr<Module> SourceM(getExternal(Ctx, "bar"));