xref: /llvm-project/clang/lib/CodeGen/LinkInModulesPass.h (revision 982c54719289c1d85d03be3ad9e95bbfd2862aee)
1c6cf3295SJacob Lambert //===-- LinkInModulesPass.h - Module Linking pass ----------------- C++ -*-===//
2c6cf3295SJacob Lambert //
3c6cf3295SJacob Lambert // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4c6cf3295SJacob Lambert // See https://llvm.org/LICENSE.txt for license information.
5c6cf3295SJacob Lambert // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6c6cf3295SJacob Lambert //
7c6cf3295SJacob Lambert //===----------------------------------------------------------------------===//
8c6cf3295SJacob Lambert /// \file
9c6cf3295SJacob Lambert ///
10c6cf3295SJacob Lambert /// This file provides a pass to link in Modules from a provided
11c6cf3295SJacob Lambert /// BackendConsumer.
12c6cf3295SJacob Lambert ///
13c6cf3295SJacob Lambert //===----------------------------------------------------------------------===//
14c6cf3295SJacob Lambert 
15c6cf3295SJacob Lambert #ifndef LLVM_BITCODE_LINKINMODULESPASS_H
16c6cf3295SJacob Lambert #define LLVM_BITCODE_LINKINMODULESPASS_H
17c6cf3295SJacob Lambert 
18c6cf3295SJacob Lambert #include "BackendConsumer.h"
19c6cf3295SJacob Lambert #include "llvm/IR/PassManager.h"
20c6cf3295SJacob Lambert 
21c6cf3295SJacob Lambert namespace llvm {
22c6cf3295SJacob Lambert class Module;
23c6cf3295SJacob Lambert class ModulePass;
24c6cf3295SJacob Lambert class Pass;
25c6cf3295SJacob Lambert 
26c6cf3295SJacob Lambert /// Create and return a pass that links in Moduels from a provided
27c6cf3295SJacob Lambert /// BackendConsumer to a given primary Module. Note that this pass is designed
28c6cf3295SJacob Lambert /// for use with the legacy pass manager.
29c6cf3295SJacob Lambert class LinkInModulesPass : public PassInfoMixin<LinkInModulesPass> {
30c6cf3295SJacob Lambert   clang::BackendConsumer *BC;
31c6cf3295SJacob Lambert 
32c6cf3295SJacob Lambert public:
33*2264544eSJacob Lambert   LinkInModulesPass(clang::BackendConsumer *BC);
34c6cf3295SJacob Lambert 
35c6cf3295SJacob Lambert   PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
isRequired()36c6cf3295SJacob Lambert   static bool isRequired() { return true; }
37c6cf3295SJacob Lambert };
38c6cf3295SJacob Lambert 
39c6cf3295SJacob Lambert } // namespace llvm
40c6cf3295SJacob Lambert 
41c6cf3295SJacob Lambert #endif
42