1 //===- llvm/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 //===----------------------------------------------------------------------===//
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.
29 DestroySource = 0, // Allow source module to be destroyed.
30 PreserveSource = 1 // Preserve the source module.
35 Module *getModule() const { return Composite; }
37 /// \brief Link \p Src into the composite. The source is destroyed if
38 /// \p Mode is DestroySource and preserved if it is PreserveSource.
39 /// If \p ErrorMsg is not null, information about any error is written
41 /// Returns true on error.
42 bool linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg);
43 bool linkInModule(Module *Src, std::string *ErrorMsg) {
44 return linkInModule(Src, Linker::DestroySource, ErrorMsg);
47 static bool LinkModules(Module *Dest, Module *Src, unsigned Mode,
48 std::string *ErrorMsg);
52 SmallPtrSet<StructType*, 32> IdentifiedStructTypes;
55 } // End llvm namespace