aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp')
-rw-r--r--contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp b/contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp
index 166ddce160..1c17b8408e 100644
--- a/contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp
+++ b/contrib/libs/llvm12/tools/llvm-objcopy/COFF/Object.cpp
@@ -31,23 +31,23 @@ void Object::updateSymbols() {
}
const Symbol *Object::findSymbol(size_t UniqueId) const {
- return SymbolMap.lookup(UniqueId);
+ return SymbolMap.lookup(UniqueId);
}
-Error Object::removeSymbols(
- function_ref<Expected<bool>(const Symbol &)> ToRemove) {
- Error Errs = Error::success();
- llvm::erase_if(Symbols, [ToRemove, &Errs](const Symbol &Sym) {
- Expected<bool> ShouldRemove = ToRemove(Sym);
- if (!ShouldRemove) {
- Errs = joinErrors(std::move(Errs), ShouldRemove.takeError());
- return false;
- }
- return *ShouldRemove;
- });
-
+Error Object::removeSymbols(
+ function_ref<Expected<bool>(const Symbol &)> ToRemove) {
+ Error Errs = Error::success();
+ llvm::erase_if(Symbols, [ToRemove, &Errs](const Symbol &Sym) {
+ Expected<bool> ShouldRemove = ToRemove(Sym);
+ if (!ShouldRemove) {
+ Errs = joinErrors(std::move(Errs), ShouldRemove.takeError());
+ return false;
+ }
+ return *ShouldRemove;
+ });
+
updateSymbols();
- return Errs;
+ return Errs;
}
Error Object::markSymbols() {
@@ -83,34 +83,34 @@ void Object::updateSections() {
}
const Section *Object::findSection(ssize_t UniqueId) const {
- return SectionMap.lookup(UniqueId);
+ return SectionMap.lookup(UniqueId);
}
void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
DenseSet<ssize_t> AssociatedSections;
auto RemoveAssociated = [&AssociatedSections](const Section &Sec) {
- return AssociatedSections.contains(Sec.UniqueId);
+ return AssociatedSections.contains(Sec.UniqueId);
};
do {
DenseSet<ssize_t> RemovedSections;
- llvm::erase_if(Sections, [ToRemove, &RemovedSections](const Section &Sec) {
- bool Remove = ToRemove(Sec);
- if (Remove)
- RemovedSections.insert(Sec.UniqueId);
- return Remove;
- });
+ llvm::erase_if(Sections, [ToRemove, &RemovedSections](const Section &Sec) {
+ bool Remove = ToRemove(Sec);
+ if (Remove)
+ RemovedSections.insert(Sec.UniqueId);
+ return Remove;
+ });
// Remove all symbols referring to the removed sections.
AssociatedSections.clear();
- llvm::erase_if(
- Symbols, [&RemovedSections, &AssociatedSections](const Symbol &Sym) {
- // If there are sections that are associative to a removed
- // section,
- // remove those as well as nothing will include them (and we can't
- // leave them dangling).
- if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == 1)
- AssociatedSections.insert(Sym.TargetSectionId);
- return RemovedSections.contains(Sym.TargetSectionId);
- });
+ llvm::erase_if(
+ Symbols, [&RemovedSections, &AssociatedSections](const Symbol &Sym) {
+ // If there are sections that are associative to a removed
+ // section,
+ // remove those as well as nothing will include them (and we can't
+ // leave them dangling).
+ if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == 1)
+ AssociatedSections.insert(Sym.TargetSectionId);
+ return RemovedSections.contains(Sym.TargetSectionId);
+ });
ToRemove = RemoveAssociated;
} while (!AssociatedSections.empty());
updateSections();