forked from OSchip/llvm-project
[COFF] Fix error handling in ResourceSectionRef
Previously, the expression (Reader.readFoo()) was expanded twice, triggering asserts as one of the Error types ends up not checked (and as it was expanded twice, the method would end up called twice if it failed first). Differential Revision: https://reviews.llvm.org/D66817 llvm-svn: 370309
This commit is contained in:
parent
e3e8874b89
commit
357a40ec7c
|
@ -1662,9 +1662,12 @@ std::error_code BaseRelocRef::getRVA(uint32_t &Result) const {
|
|||
return std::error_code();
|
||||
}
|
||||
|
||||
#define RETURN_IF_ERROR(E) \
|
||||
if (E) \
|
||||
return E;
|
||||
#define RETURN_IF_ERROR(Expr) \
|
||||
do { \
|
||||
Error E = (Expr); \
|
||||
if (E) \
|
||||
return std::move(E); \
|
||||
} while (0)
|
||||
|
||||
Expected<ArrayRef<UTF16>>
|
||||
ResourceSectionRef::getDirStringAtOffset(uint32_t Offset) {
|
||||
|
|
Loading…
Reference in New Issue