1 //===- Linker.h - Module Linker Interface -----------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LINKER_LINKER_H
11 #define LLVM_LINKER_LINKER_H
13 #include "llvm/ADT/SmallPtrSet.h"
22 /// This class provides the core functionality of linking in LLVM. It keeps a
23 /// pointer to the merged module so far. It doesn't take ownership of the
24 /// module since it is assumed that the user of this class will want to do
25 /// something with it after the linking.
28 typedef std::function<void(const DiagnosticInfo &)> DiagnosticHandlerFunction;
30 Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
34 Module *getModule() const { return Composite; }
37 /// \brief Link \p Src into the composite. The source is destroyed.
38 /// Returns true on error.
39 bool linkInModule(Module *Src);
41 static bool LinkModules(Module *Dest, Module *Src,
42 DiagnosticHandlerFunction DiagnosticHandler);
44 static bool LinkModules(Module *Dest, Module *Src);
47 void init(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
49 SmallPtrSet<StructType *, 32> IdentifiedStructTypes;
50 DiagnosticHandlerFunction DiagnosticHandler;
53 } // End llvm namespace