From 8be28cdc5281edbe83886168978303345ca4a78b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 2 May 2019 10:32:03 +0000 Subject: [Object] Change getSectionName() to return Expected Summary: It currently receives an output parameter and returns std::error_code. Expected fits for this purpose perfectly. Differential Revision: https://reviews.llvm.org/D61421 llvm-svn: 359774 --- llvm/lib/Object/ObjectFile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Object/ObjectFile.cpp') 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 NameOrErr = getSectionName(Sec)) + return *NameOrErr == ".llvmbc"; return false; } -- cgit v1.2.3