[llvm] r260683 - Delete the deprecated LLVMLinkModules.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 07:28:45 PST 2016


Author: rafael
Date: Fri Feb 12 09:28:45 2016
New Revision: 260683

URL: http://llvm.org/viewvc/llvm-project?rev=260683&view=rev
Log:
Delete the deprecated LLVMLinkModules.

Modified:
    llvm/trunk/docs/ReleaseNotes.rst
    llvm/trunk/include/llvm-c/Linker.h
    llvm/trunk/include/llvm/Linker/Linker.h
    llvm/trunk/lib/Linker/LinkModules.cpp
    llvm/trunk/unittests/Linker/LinkModulesTest.cpp

Modified: llvm/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.rst?rev=260683&r1=260682&r2=260683&view=diff
==============================================================================
--- llvm/trunk/docs/ReleaseNotes.rst (original)
+++ llvm/trunk/docs/ReleaseNotes.rst Fri Feb 12 09:28:45 2016
@@ -35,11 +35,13 @@ Non-comprehensive list of changes in thi
 =================================================
 * .. 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

Modified: llvm/trunk/include/llvm-c/Linker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Linker.h?rev=260683&r1=260682&r2=260683&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Linker.h (original)
+++ llvm/trunk/include/llvm-c/Linker.h Fri Feb 12 09:28:45 2016
@@ -28,20 +28,6 @@ typedef enum {
 } 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.
  * Use the diagnostic handler to get any diagnostic message.

Modified: llvm/trunk/include/llvm/Linker/Linker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker/Linker.h?rev=260683&r1=260682&r2=260683&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Linker/Linker.h (original)
+++ llvm/trunk/include/llvm/Linker/Linker.h Fri Feb 12 09:28:45 2016
@@ -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);
 

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=260683&r1=260682&r2=260683&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri Feb 12 09:28:45 2016
@@ -557,11 +557,6 @@ bool Linker::linkInModule(std::unique_pt
   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, s
 // 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));

Modified: llvm/trunk/unittests/Linker/LinkModulesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Linker/LinkModulesTest.cpp?rev=260683&r1=260682&r2=260683&view=diff
==============================================================================
--- llvm/trunk/unittests/Linker/LinkModulesTest.cpp (original)
+++ llvm/trunk/unittests/Linker/LinkModulesTest.cpp Fri Feb 12 09:28:45 2016
@@ -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"));




More information about the llvm-commits mailing list