llvm-project
33 строки · 1.0 Кб
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//===----------------------------------------------------------------------===//
13
14#include "LinkInModulesPass.h"15#include "BackendConsumer.h"16
17#include "clang/Basic/CodeGenOptions.h"18#include "clang/Basic/FileManager.h"19#include "clang/Basic/SourceManager.h"20
21using namespace llvm;22
23LinkInModulesPass::LinkInModulesPass(clang::BackendConsumer *BC) : BC(BC) {}24
25PreservedAnalyses LinkInModulesPass::run(Module &M, ModuleAnalysisManager &AM) {26if (!BC)27return PreservedAnalyses::all();28
29if (BC->LinkInModules(&M))30report_fatal_error("Bitcode module postopt linking failed, aborted!");31
32return PreservedAnalyses::none();33}
34