clang 19.0.0git
LinkInModulesPass.cpp
Go to the documentation of this file.
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
20
21using namespace llvm;
22
24 bool ShouldLinkFiles)
25 : BC(BC), ShouldLinkFiles(ShouldLinkFiles) {}
26
27PreservedAnalyses LinkInModulesPass::run(Module &M, ModuleAnalysisManager &AM) {
28 if (!BC)
29 return PreservedAnalyses::all();
30
31 // Re-load bitcode modules from files
32 if (BC->ReloadModules(&M))
33 report_fatal_error("Bitcode module re-loading failed, aborted!");
34
35 if (BC->LinkInModules(&M, ShouldLinkFiles))
36 report_fatal_error("Bitcode module re-linking failed, aborted!");
37
38 return PreservedAnalyses::all();
39}
Defines the clang::FileManager interface and associated types.
This file provides a pass to link in Modules from a provided BackendConsumer.
Defines the SourceManager interface.
bool LinkInModules(llvm::Module *M, bool ShouldLinkFiles=true)
bool ReloadModules(llvm::Module *M)
PreservedAnalyses run(Module &M, AnalysisManager< Module > &)
LinkInModulesPass(clang::BackendConsumer *BC, bool ShouldLinkFiles=true)
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30