Delete dead code.
[oota-llvm.git] / include / llvm / Linker / Linker.h
index aac9dcdcb36bb6bc932018f33e27d8980404a21d..f9890935126ec1f7c3f9c3b10ec177810c29d8c8 100644 (file)
@@ -14,6 +14,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/FunctionInfo.h"
 
 namespace llvm {
 class Module;
@@ -54,33 +55,44 @@ public:
     NonOpaqueStructTypeSet NonOpaqueStructTypes;
 
     void addNonOpaque(StructType *Ty);
+    void switchToNonOpaque(StructType *Ty);
     void addOpaque(StructType *Ty);
     StructType *findNonOpaque(ArrayRef<Type *> ETypes, bool IsPacked);
     bool hasType(StructType *Ty);
   };
 
-  Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
-  Linker(Module *M);
-  ~Linker();
+  enum Flags {
+    None = 0,
+    OverrideFromSrc = (1 << 0),
+    LinkOnlyNeeded = (1 << 1),
+    InternalizeLinkedSymbols = (1 << 2)
+  };
 
-  Module *getModule() const { return Composite; }
-  void deleteModule();
+  Linker(Module &M, DiagnosticHandlerFunction DiagnosticHandler);
+  Linker(Module &M);
 
   /// \brief Link \p Src into the composite. The source is destroyed.
+  ///
+  /// Passing OverrideSymbols as true will have symbols from Src
+  /// shadow those in the Dest.
+  /// For ThinLTO function importing/exporting the \p FunctionInfoIndex
+  /// is passed. If \p FunctionsToImport is provided, only the functions that
+  /// are part of the set will be imported from the source module.
+  ///
   /// Returns true on error.
-  bool linkInModule(Module *Src);
-
-  /// \brief Set the composite to the passed-in module.
-  void setModule(Module *Dst);
+  bool linkInModule(Module &Src, unsigned Flags = Flags::None,
+                    const FunctionInfoIndex *Index = nullptr,
+                    DenseSet<const GlobalValue *> *FunctionsToImport = nullptr);
 
-  static bool LinkModules(Module *Dest, Module *Src,
-                          DiagnosticHandlerFunction DiagnosticHandler);
+  static bool linkModules(Module &Dest, Module &Src,
+                          DiagnosticHandlerFunction DiagnosticHandler,
+                          unsigned Flags = Flags::None);
 
-  static bool LinkModules(Module *Dest, Module *Src);
+  static bool linkModules(Module &Dest, Module &Src,
+                          unsigned Flags = Flags::None);
 
 private:
-  void init(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
-  Module *Composite;
+  Module &Composite;
 
   IdentifiedStructTypeSet IdentifiedStructTypes;