LLVM 20.0.0git
DWARFFile.h
Go to the documentation of this file.
1//===- DWARFFile.h ----------------------------------------------*- 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
9#ifndef LLVM_DWARFLINKER_DWARFFILE_H
10#define LLVM_DWARFLINKER_DWARFFILE_H
11
12#include "AddressesMap.h"
13#include "llvm/ADT/StringRef.h"
15#include <functional>
16#include <memory>
17
18namespace llvm {
19namespace dwarf_linker {
20
21/// This class represents DWARF information for source file
22/// and it's address map.
23///
24/// May be used asynchroniously for reading.
25class DWARFFile {
26public:
27 using UnloadCallbackTy = std::function<void(StringRef FileName)>;
28
29 DWARFFile(StringRef Name, std::unique_ptr<DWARFContext> Dwarf,
30 std::unique_ptr<AddressesMap> Addresses,
34
35 /// Object file name.
37
38 /// Source DWARF information.
39 std::unique_ptr<DWARFContext> Dwarf;
40
41 /// Helpful address information(list of valid address ranges, relocations).
42 std::unique_ptr<AddressesMap> Addresses;
43
44 /// Callback to the module keeping object file to unload.
46
47 /// Unloads object file and corresponding AddressesMap and Dwarf Context.
48 void unload() {
49 Addresses.reset();
50 Dwarf.reset();
51
52 if (UnloadFunc)
54 }
55};
56
57} // namespace dwarf_linker
58} // end namespace llvm
59
60#endif // LLVM_DWARFLINKER_DWARFFILE_H
std::string Name
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class represents DWARF information for source file and it's address map.
Definition: DWARFFile.h:25
std::unique_ptr< AddressesMap > Addresses
Helpful address information(list of valid address ranges, relocations).
Definition: DWARFFile.h:42
UnloadCallbackTy UnloadFunc
Callback to the module keeping object file to unload.
Definition: DWARFFile.h:45
std::function< void(StringRef FileName)> UnloadCallbackTy
Definition: DWARFFile.h:27
void unload()
Unloads object file and corresponding AddressesMap and Dwarf Context.
Definition: DWARFFile.h:48
StringRef FileName
Object file name.
Definition: DWARFFile.h:36
DWARFFile(StringRef Name, std::unique_ptr< DWARFContext > Dwarf, std::unique_ptr< AddressesMap > Addresses, UnloadCallbackTy UnloadFunc=nullptr)
Definition: DWARFFile.h:29
std::unique_ptr< DWARFContext > Dwarf
Source DWARF information.
Definition: DWARFFile.h:39
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1856
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858