xref: /freebsd/contrib/llvm-project/lld/MachO/LTO.h (revision 681ce946)
1 //===- LTO.h ----------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLD_MACHO_LTO_H
10 #define LLD_MACHO_LTO_H
11 
12 #include "llvm/ADT/SmallString.h"
13 #include "llvm/Support/MemoryBuffer.h"
14 #include <memory>
15 #include <vector>
16 
17 namespace llvm {
18 namespace lto {
19 class LTO;
20 } // namespace lto
21 } // namespace llvm
22 
23 namespace lld {
24 namespace macho {
25 
26 class BitcodeFile;
27 class ObjFile;
28 
29 class BitcodeCompiler {
30 public:
31   BitcodeCompiler();
32 
33   void add(BitcodeFile &f);
34   std::vector<ObjFile *> compile();
35 
36 private:
37   std::unique_ptr<llvm::lto::LTO> ltoObj;
38   std::vector<llvm::SmallString<0>> buf;
39   std::vector<std::unique_ptr<llvm::MemoryBuffer>> files;
40 };
41 
42 } // namespace macho
43 } // namespace lld
44 
45 #endif
46