[PATCH] D59081: [llvm-objcopy] Remove unneeded checks. NFC
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 12 05:43:31 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355914: [llvm-objcopy] Remove unneeded checks. NFC (authored by evgeny777, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D59081?vs=189666&id=190238#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59081/new/
https://reviews.llvm.org/D59081
Files:
llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
Index: llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
===================================================================
--- llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
+++ llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
@@ -520,35 +520,31 @@
}
}
}
-
- if (!Config.AddSection.empty()) {
- for (const auto &Flag : Config.AddSection) {
- std::pair<StringRef, StringRef> SecPair = Flag.split("=");
- StringRef SecName = SecPair.first;
- StringRef File = SecPair.second;
- ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
- MemoryBuffer::getFile(File);
- if (!BufOrErr)
- return createFileError(File, errorCodeToError(BufOrErr.getError()));
- std::unique_ptr<MemoryBuffer> Buf = std::move(*BufOrErr);
- ArrayRef<uint8_t> Data(
- reinterpret_cast<const uint8_t *>(Buf->getBufferStart()),
- Buf->getBufferSize());
- OwnedDataSection &NewSection =
- Obj.addSection<OwnedDataSection>(SecName, Data);
- if (SecName.startswith(".note") && SecName != ".note.GNU-stack")
- NewSection.Type = SHT_NOTE;
- }
- }
-
- if (!Config.DumpSection.empty()) {
- for (const auto &Flag : Config.DumpSection) {
- std::pair<StringRef, StringRef> SecPair = Flag.split("=");
- StringRef SecName = SecPair.first;
- StringRef File = SecPair.second;
- if (Error E = dumpSectionToFile(SecName, File, Obj))
- return createFileError(Config.InputFilename, std::move(E));
- }
+
+ for (const auto &Flag : Config.AddSection) {
+ std::pair<StringRef, StringRef> SecPair = Flag.split("=");
+ StringRef SecName = SecPair.first;
+ StringRef File = SecPair.second;
+ ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
+ MemoryBuffer::getFile(File);
+ if (!BufOrErr)
+ return createFileError(File, errorCodeToError(BufOrErr.getError()));
+ std::unique_ptr<MemoryBuffer> Buf = std::move(*BufOrErr);
+ ArrayRef<uint8_t> Data(
+ reinterpret_cast<const uint8_t *>(Buf->getBufferStart()),
+ Buf->getBufferSize());
+ OwnedDataSection &NewSection =
+ Obj.addSection<OwnedDataSection>(SecName, Data);
+ if (SecName.startswith(".note") && SecName != ".note.GNU-stack")
+ NewSection.Type = SHT_NOTE;
+ }
+
+ for (const auto &Flag : Config.DumpSection) {
+ std::pair<StringRef, StringRef> SecPair = Flag.split("=");
+ StringRef SecName = SecPair.first;
+ StringRef File = SecPair.second;
+ if (Error E = dumpSectionToFile(SecName, File, Obj))
+ return createFileError(Config.InputFilename, std::move(E));
}
if (!Config.AddGnuDebugLink.empty())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59081.190238.patch
Type: text/x-patch
Size: 2643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190312/33b4a378/attachment.bin>
More information about the llvm-commits
mailing list