[PATCH] D61421: [Object] Change getSectionName() to use Expected<StringRef>
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 03:30:22 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD359774: [Object] Change getSectionName() to return Expected<StringRef> (authored by MaskRay, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D61421?vs=197730&id=197731#toc
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61421/new/
https://reviews.llvm.org/D61421
Files:
COFF/Chunks.cpp
COFF/InputFiles.cpp
Index: COFF/InputFiles.cpp
===================================================================
--- COFF/InputFiles.cpp
+++ COFF/InputFiles.cpp
@@ -168,9 +168,11 @@
const coff_section *Sec = getSection(SectionNumber);
StringRef Name;
- if (auto EC = COFFObj->getSectionName(Sec, Name))
+ if (Expected<StringRef> E = COFFObj->getSectionName(Sec))
+ Name = *E;
+ else
fatal("getSectionName failed: #" + Twine(SectionNumber) + ": " +
- EC.message());
+ toString(E.takeError()));
if (Name == ".drectve") {
ArrayRef<uint8_t> Data;
@@ -242,7 +244,8 @@
COFFObj->getSymbolName(Sym, Name);
const coff_section *ParentSec = getSection(ParentIndex);
- COFFObj->getSectionName(ParentSec, ParentName);
+ if (Expected<StringRef> E = COFFObj->getSectionName(ParentSec))
+ ParentName = *E;
error(toString(this) + ": associative comdat " + Name + " (sec " +
Twine(SectionNumber) + ") has invalid reference to section " +
ParentName + " (sec " + Twine(ParentIndex) + ")");
Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -33,7 +33,8 @@
: Chunk(SectionKind), File(F), Header(H),
Relocs(File->getCOFFObj()->getRelocations(Header)), Repl(this) {
// Initialize SectionName.
- File->getCOFFObj()->getSectionName(Header, SectionName);
+ if (Expected<StringRef> E = File->getCOFFObj()->getSectionName(Header))
+ SectionName = *E;
Alignment = Header->getAlignment();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61421.197731.patch
Type: text/x-patch
Size: 1549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190502/63d815fe/attachment.bin>
More information about the llvm-commits
mailing list