[PATCH] D77289: [Object] Fix crash caused by unhandled error.
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 8 10:19:00 PDT 2020
sbc100 added inline comments.
================
Comment at: llvm/include/llvm/Object/ObjectFile.h:302
+ return getCommonSymbolSizeImpl(Symb);
+ } else
+ report_fatal_error(SymbolFlagsOrErr.takeError());
----------------
Use early return here?
```
auto SymbolFlagsOrErr = getSymbolFlags(Symb);
if (!SymbolFlagsOrErr)
report_fatal_error(SymbolFlagsOrErr.takeError());
assert(*SymbolFlagsOrErr & SymbolRef::SF_Common);
return getCommonSymbolSizeImpl(Symb);
```
This would also avoid "else-after-return".
================
Comment at: llvm/lib/ExecutionEngine/RuntimeDyld/JITSymbol.cpp:87
+ return Flags;
+ } else
+ report_fatal_error(SymbolFlagsOrErr.takeError());
----------------
Ditto, use early return and avoid else after return.
================
Comment at: llvm/tools/llvm-size/llvm-size.cpp:207
+ // FIXME: Actually report errors helpfully.
+ report_fatal_error(SymFlagsOrErr.takeError());
+ }
----------------
Use early return?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77289/new/
https://reviews.llvm.org/D77289
More information about the llvm-commits
mailing list