[NFC][analyzer][docs] Crosslink MallocChecker's ownership attributes (#121939)
[llvm-project.git] / clang / lib / CodeGen / LinkInModulesPass.cpp
blob6f168ea4a53dd883fb29a2a77c4ec3b0b469d2c3
1 //===-- LinkInModulesPass.cpp - Module Linking pass --------------- 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 /// \file
9 ///
10 /// LinkInModulesPass implementation.
11 ///
12 //===----------------------------------------------------------------------===//
14 #include "LinkInModulesPass.h"
15 #include "BackendConsumer.h"
17 using namespace llvm;
19 LinkInModulesPass::LinkInModulesPass(clang::BackendConsumer *BC) : BC(BC) {}
21 PreservedAnalyses LinkInModulesPass::run(Module &M, ModuleAnalysisManager &AM) {
22 if (!BC)
23 return PreservedAnalyses::all();
25 if (BC->LinkInModules(&M))
26 report_fatal_error("Bitcode module postopt linking failed, aborted!");
28 return PreservedAnalyses::none();