summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/ObjectFile.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-05-02 10:32:03 +0000
committerFangrui Song <maskray@google.com>2019-05-02 10:32:03 +0000
commit8be28cdc5281edbe83886168978303345ca4a78b (patch)
tree613ac659e7c0e7384806266757e1fbf34bf418c6 /llvm/lib/Object/ObjectFile.cpp
parent71569d0d523465203ba465a89c37d75075a5e2c2 (diff)
downloadbcm5719-llvm-8be28cdc5281edbe83886168978303345ca4a78b.tar.gz
bcm5719-llvm-8be28cdc5281edbe83886168978303345ca4a78b.zip
[Object] Change getSectionName() to return Expected<StringRef>
Summary: It currently receives an output parameter and returns std::error_code. Expected<StringRef> fits for this purpose perfectly. Differential Revision: https://reviews.llvm.org/D61421 llvm-svn: 359774
Diffstat (limited to 'llvm/lib/Object/ObjectFile.cpp')
-rw-r--r--llvm/lib/Object/ObjectFile.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp
index 081e29c21b6..cc0b282665d 100644
--- a/llvm/lib/Object/ObjectFile.cpp
+++ b/llvm/lib/Object/ObjectFile.cpp
@@ -68,9 +68,8 @@ std::error_code ObjectFile::printSymbolName(raw_ostream &OS,
uint32_t ObjectFile::getSymbolAlignment(DataRefImpl DRI) const { return 0; }
bool ObjectFile::isSectionBitcode(DataRefImpl Sec) const {
- StringRef SectName;
- if (!getSectionName(Sec, SectName))
- return SectName == ".llvmbc";
+ if (Expected<StringRef> NameOrErr = getSectionName(Sec))
+ return *NameOrErr == ".llvmbc";
return false;
}
OpenPOWER on IntegriCloud