[PATCH] Refactor: Simplify boolean conditional return statements in llvm/lib/DebugInfo/DWARF

Richard legalize at xmission.com
Sun May 24 23:55:22 PDT 2015


Hi friss, zturner, bkramer,

Use clang-tidy to simplify boolean conditional return statements

http://reviews.llvm.org/D9972

Files:
  lib/DebugInfo/DWARF/DWARFFormValue.cpp
  lib/DebugInfo/DWARF/DWARFUnit.cpp

Index: lib/DebugInfo/DWARF/DWARFFormValue.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -127,10 +127,8 @@
   // In DWARF3 DW_FORM_data4 and DW_FORM_data8 served also as a section offset.
   // Don't check for DWARF version here, as some producers may still do this
   // by mistake.
-  if ((Form == DW_FORM_data4 || Form == DW_FORM_data8) &&
-      FC == FC_SectionOffset)
-    return true;
-  return false;
+  return (Form == DW_FORM_data4 || Form == DW_FORM_data8) &&
+      FC == FC_SectionOffset;
 }
 
 bool DWARFFormValue::extractValue(DataExtractor data, uint32_t *offset_ptr,
Index: lib/DebugInfo/DWARF/DWARFUnit.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -79,10 +79,7 @@
     return false;
 
   Abbrevs = Abbrev->getAbbreviationDeclarationSet(AbbrOffset);
-  if (Abbrevs == nullptr)
-    return false;
-
-  return true;
+  return Abbrevs != nullptr;
 }
 
 bool DWARFUnit::extract(DataExtractor debug_info, uint32_t *offset_ptr) {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9972.26398.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150525/d28c95c6/attachment.bin>


More information about the llvm-commits mailing list