[PATCH] Refactor: Simplify boolean conditional return statements in clang-modernize

Richard legalize at xmission.com
Mon May 25 15:33:18 PDT 2015


Hi alexfh,

Use clang-tidy to simplify boolean conditional return statements

http://reviews.llvm.org/D10026

Files:
  clang-modernize/UseNullptr/NullptrActions.cpp

Index: clang-modernize/UseNullptr/NullptrActions.cpp
===================================================================
--- clang-modernize/UseNullptr/NullptrActions.cpp
+++ clang-modernize/UseNullptr/NullptrActions.cpp
@@ -256,10 +256,7 @@
     else
       llvm_unreachable("Unhandled ContainingAncestor node type");
 
-    if (ArgUsageVisitor.foundInvalid())
-      return false;
-
-    return true;
+    return !ArgUsageVisitor.foundInvalid();
   }
 
   /// \brief Given the SourceLocation for a macro arg expansion, finds the
@@ -339,10 +336,7 @@
 
       if (!Expansion.isMacroArgExpansion()) {
         if (Loc.isFileID()) {
-          if (Loc == TestMacroLoc)
-            // Match made.
-            return true;
-          return false;
+          return Loc == TestMacroLoc;
         }
         // Since Loc is still a macro ID and it's not an argument expansion, we
         // don't need to do the work of handling an argument expansion. Simply

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


More information about the cfe-commits mailing list