[PATCH] D66817: [03/10] [COFF] Fix error handling in ResourceSectionRef

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 01:58:32 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL370309: [COFF] Fix error handling in ResourceSectionRef (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66817?vs=217464&id=217798#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66817/new/

https://reviews.llvm.org/D66817

Files:
  llvm/trunk/lib/Object/COFFObjectFile.cpp


Index: llvm/trunk/lib/Object/COFFObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp
@@ -1662,9 +1662,12 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66817.217798.patch
Type: text/x-patch
Size: 957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190829/49f0a278/attachment.bin>


More information about the llvm-commits mailing list