LLVM 22.0.0git
COFF.cpp
Go to the documentation of this file.
1//===------------------ COFF.cpp - COFF format utilities ------------------===//
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
10#include "llvm/Object/Binary.h"
11
12#define DEBUG_TYPE "orc"
13
14namespace llvm::orc {
15
17 MemoryBufferRef MemberBuf,
18 size_t Index) const {
19 // Try to build a binary for the member.
20 auto Bin = object::createBinary(MemberBuf);
21 if (!Bin) {
22 // If we can't then consume the error and return false (i.e. not loadable).
23 consumeError(Bin.takeError());
24 return false;
25 }
26
27 // If this is a COFF import file then handle it and return false (not
28 // loadable).
29 if ((*Bin)->isCOFFImportFile()) {
30 ImportedDynamicLibraries.insert((*Bin)->getFileName().str());
31 return false;
32 }
33
34 // Otherwise the member is loadable (at least as far as COFFImportFileScanner
35 // is concerned), so return true;
36 return true;
37}
38
39} // namespace llvm::orc
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Tagged union holding either a T or a Error.
Definition Error.h:485
LLVM_ABI Expected< bool > operator()(object::Archive &A, MemoryBufferRef MemberBuf, size_t Index) const
Definition COFF.cpp:16
LLVM_ABI Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
Definition Binary.cpp:45
void consumeError(Error Err)
Consume a Error without doing anything.
Definition Error.h:1083