summaryrefslogtreecommitdiff
path: root/tools/llvm-size/llvm-size.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-size/llvm-size.cpp')
-rw-r--r--tools/llvm-size/llvm-size.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/llvm-size/llvm-size.cpp b/tools/llvm-size/llvm-size.cpp
index 3de6605285..cb805c2633 100644
--- a/tools/llvm-size/llvm-size.cpp
+++ b/tools/llvm-size/llvm-size.cpp
@@ -244,11 +244,12 @@ static void PrintFileSectionSizes(StringRef file) {
}
// Attempt to open the binary.
- OwningPtr<Binary> binary;
- if (error_code ec = createBinary(file, binary)) {
- errs() << ToolName << ": " << file << ": " << ec.message() << ".\n";
+ ErrorOr<Binary *> BinaryOrErr = createBinary(file);
+ if (error_code EC = BinaryOrErr.getError()) {
+ errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
return;
}
+ OwningPtr<Binary> binary(BinaryOrErr.get());
if (Archive *a = dyn_cast<Archive>(binary.get())) {
// This is an archive. Iterate over each member and display its sizes.