diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-15 19:37:43 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-15 19:37:43 +0000 |
commit | 1fca78a9b1d78ac2e05174e8b8b0eda5fe4ab8b3 (patch) | |
tree | 442cb69d47dec1c6c5ba601e847365ee625328a7 /tools/llvm-size | |
parent | 0893113a05af8b67799965685e96c11a59908a95 (diff) | |
download | llvm-1fca78a9b1d78ac2e05174e8b8b0eda5fe4ab8b3.tar.gz llvm-1fca78a9b1d78ac2e05174e8b8b0eda5fe4ab8b3.tar.bz2 llvm-1fca78a9b1d78ac2e05174e8b8b0eda5fe4ab8b3.tar.xz |
Return an ErrorOr<Binary *> from createBinary.
I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too
cumbersome to use without std::move. I will keep the patch locally and submit
when we switch to c++11.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199326 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-size')
-rw-r--r-- | tools/llvm-size/llvm-size.cpp | 7 |
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. |