[PATCH] Refactor: Simplify boolean conditional return statements in lib/Basic

Richard legalize at xmission.com
Mon May 25 12:52:54 PDT 2015


Hi doug.gregor, rsmith, rjmccall, akyrtzi, krememek, majnemer,

Use clang-tidy to simplify boolean conditional return statements

http://reviews.llvm.org/D10011

Files:
  lib/Basic/DiagnosticIDs.cpp
  lib/Basic/VirtualFileSystem.cpp

Index: lib/Basic/DiagnosticIDs.cpp
===================================================================
--- lib/Basic/DiagnosticIDs.cpp
+++ lib/Basic/DiagnosticIDs.cpp
@@ -709,10 +709,7 @@
     return false;
 
   // Currently we consider all ARC errors as recoverable.
-  if (isARCDiagnostic(DiagID))
-    return false;
-
-  return true;
+  return !isARCDiagnostic(DiagID);
 }
 
 bool DiagnosticIDs::isARCDiagnostic(unsigned DiagID) {
Index: lib/Basic/VirtualFileSystem.cpp
===================================================================
--- lib/Basic/VirtualFileSystem.cpp
+++ lib/Basic/VirtualFileSystem.cpp
@@ -838,9 +838,7 @@
     if (Stream.failed())
       return false;
 
-    if (!checkMissingKeys(Top, Keys))
-      return false;
-    return true;
+    return checkMissingKeys(Top, Keys);
   }
 };
 } // end of anonymous namespace

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


More information about the cfe-commits mailing list