16using namespace object;
19 for (
Symbol S : NewSymbols) {
20 S.UniqueId = NextSymbolUniqueId++;
21 Symbols.emplace_back(S);
26void Object::updateSymbols() {
29 SymbolMap[
Sym.UniqueId] = &
Sym;
33 return SymbolMap.lookup(UniqueId);
54 Sym.Referenced =
false;
55 for (
const Section &Sec : Sections) {
57 auto It = SymbolMap.find(R.Target);
58 if (It == SymbolMap.end())
60 "relocation target %zu not found", R.Target);
61 It->second->Referenced =
true;
69 S.UniqueId = NextSectionUniqueId++;
70 Sections.emplace_back(S);
75void Object::updateSections() {
79 SectionMap[S.UniqueId] = &S;
85 return SectionMap.lookup(UniqueId);
90 auto RemoveAssociated = [&AssociatedSections](
const Section &Sec) {
91 return AssociatedSections.
contains(Sec.UniqueId);
102 AssociatedSections.
clear();
104 Symbols, [&RemovedSections, &AssociatedSections](
const Symbol &
Sym) {
109 if (RemovedSections.
contains(
Sym.AssociativeComdatTargetSectionId))
110 AssociatedSections.
insert(
Sym.TargetSectionId);
111 return RemovedSections.
contains(
Sym.TargetSectionId);
114 }
while (!AssociatedSections.
empty());
120 for (
Section &Sec : Sections) {
121 if (ToTruncate(Sec)) {
124 Sec.Header.SizeOfRawData = 0;
ReachingDefAnalysis InstSet & ToRemove
This file defines the DenseSet and SmallDenseSet classes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Implements a dense probed hash-table based set.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
std::pair< iterator, bool > insert(const ValueT &V)
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
An efficient, type-erasing, non-owning reference to a callable.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
void truncateSections(function_ref< bool(const Section &)> ToTruncate)
const Symbol * findSymbol(size_t UniqueId) const
const Section * findSection(ssize_t UniqueId) const
void addSections(ArrayRef< Section > NewSections)
void removeSections(function_ref< bool(const Section &)> ToRemove)
void addSymbols(ArrayRef< Symbol > NewSymbols)
Error removeSymbols(function_ref< Expected< bool >(const Symbol &)> ToRemove)