1 //===-- LinkInModulesPass.cpp - Module Linking pass --------------- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// LinkInModulesPass implementation.
12 //===----------------------------------------------------------------------===//
14 #include "LinkInModulesPass.h"
15 #include "BackendConsumer.h"
17 #include "clang/Basic/CodeGenOptions.h"
18 #include "clang/Basic/FileManager.h"
19 #include "clang/Basic/SourceManager.h"
23 LinkInModulesPass::LinkInModulesPass(clang::BackendConsumer
*BC
) : BC(BC
) {}
25 PreservedAnalyses
LinkInModulesPass::run(Module
&M
, ModuleAnalysisManager
&AM
) {
27 return PreservedAnalyses::all();
29 if (BC
->LinkInModules(&M
))
30 report_fatal_error("Bitcode module postopt linking failed, aborted!");
32 return PreservedAnalyses::none();