[llvm] r284454 - Object: Add a missing return in ObjectFile::createObjectFile
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 17 22:17:23 PDT 2016
Author: bogner
Date: Tue Oct 18 00:17:23 2016
New Revision: 284454
URL: http://llvm.org/viewvc/llvm-project?rev=284454&view=rev
Log:
Object: Add a missing return in ObjectFile::createObjectFile
When Error was threaded through these APIs back in r265606 the
"return" was missed here, which triggers a warning if/when I add
LLVM_NODISCARD to the Error type.
Modified:
llvm/trunk/lib/Object/ObjectFile.cpp
Modified: llvm/trunk/lib/Object/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ObjectFile.cpp?rev=284454&r1=284453&r2=284454&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ObjectFile.cpp Tue Oct 18 00:17:23 2016
@@ -118,8 +118,8 @@ ObjectFile::createObjectFile(StringRef O
Expected<std::unique_ptr<ObjectFile>> ObjOrErr =
createObjectFile(Buffer->getMemBufferRef());
- if (!ObjOrErr)
- ObjOrErr.takeError();
+ if (Error Err = ObjOrErr.takeError())
+ return std::move(Err);
std::unique_ptr<ObjectFile> Obj = std::move(ObjOrErr.get());
return OwningBinary<ObjectFile>(std::move(Obj), std::move(Buffer));
More information about the llvm-commits
mailing list