14
14
#ifndef LLVM_LINKER_H
15
15
#define LLVM_LINKER_H
16
16
17
+ #include " llvm/Support/CommandLine.h"
17
18
#include < string>
18
19
#include < vector>
19
20
#include < set>
@@ -22,6 +23,42 @@ namespace llvm {
22
23
23
24
class Module ;
24
25
26
+ // / This type is used to pass the linkage items (libraries and files) to
27
+ // / the LinkItems function. It is composed of string/bool pairs. The string
28
+ // / provides the name of the file or library (as with the -l option). The bool
29
+ // / should be true for libraries, false for files, signifying "isLibrary".
30
+ // / @brief A list of string/bool pairs
31
+ typedef std::vector<std::pair<std::string,bool > > LinkItemList;
32
+
33
+ // / This function can be used to link a set of linkage items into a module. A
34
+ // / linkage item is one of the three things identified by the LinkItemKind
35
+ // / enumeration. This function allows linking to preserve the order of
36
+ // / specification associated with a command line, or for other purposes. Each
37
+ // / item will be linked in turn as it occurs in \p Items. Note that library
38
+ // / path items will only be in effect after they have been processed.
39
+ // / @returns The aggregated/linked Module.
40
+ // / @throws nothing
41
+ Module* LinkItems (
42
+ const char * progname, // /< Name of the program being linked (for output)
43
+ const LinkItemList& Items, // Set of libraries/files to link in
44
+ const std::vector<std::string>& LibPaths, // Paths to search for libraries
45
+ bool Verbose, // /< Link verbosely, indicating each action
46
+ bool Native // /< Linking is for a native executable
47
+ );
48
+
49
+ // / This function provides some utility for tools that need to build the list
50
+ // / of link items from a triplet of command line options: Files, Libraries, and
51
+ // / LibraryPaths. The command line ordering is preserved by this function even
52
+ // / though the options are split into three separate cl::list<std::string>. The
53
+ // / resulting \p OutList is suitable for use with LinkItems.
54
+ // / @see LinkItems
55
+ // / @throws nothing
56
+ void BuildLinkItems (
57
+ LinkItemList& OutList,
58
+ const cl::list<std::string>& Files, // /< List of files to put in list
59
+ const cl::list<std::string>& Libs // /< List of libraries to put in list
60
+ );
61
+
25
62
// / This is the heart of the linker. The \p Src module is linked into the \p
26
63
// / Dest module. If an error occurs, true is returned, otherwise false. If \p
27
64
// / ErrorMsg is not null and an error occurs, \p *ErrorMsg will be set to a
0 commit comments