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"
14 #include "llvm/ADT/STLExtras.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 function_ref<void(const DiagnosticInfo &)>
29 DiagnosticHandlerFunction;
31 Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
35 Module *getModule() const { return Composite; }
38 /// \brief Link \p Src into the composite. The source is destroyed.
39 /// Returns true on error.
40 bool linkInModule(Module *Src);
42 static bool LinkModules(Module *Dest, Module *Src,
43 DiagnosticHandlerFunction DiagnosticHandler);
45 static bool LinkModules(Module *Dest, Module *Src);
49 SmallPtrSet<StructType*, 32> IdentifiedStructTypes;
50 DiagnosticHandlerFunction DiagnosticHandler;
53 } // End llvm namespace